Attach to process

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
alqui
Posts: 2
Joined: Fri Jun 24, 2011 5:52 pm

Attach to process

Post by alqui » Fri Jun 24, 2011 5:57 pm

Hi,

I'm trying to attach .net memory profiler to a process.

To be more specific, I try to attach it to a w3wp process hosting an ASP.NET (3.5) web application.

But when I click on Attach to process....there is almost no process to attach to. And w3wp is not there.

But when I go check in Task Manager, it definitely there.

Why not all process are listed in the Attach to process dialog ? What are the filters applied to this dialog so only a couple of process are there ? Is the the .net framework version of my ASP.Net application ? Is it the x64, x86 version of the .NET memory profiler ?

Note : I'm running the .net memory profiler on a windows 2008 server x64.

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Re: Attach to process

Post by Andreas Suurkuusk » Sun Jun 26, 2011 9:06 pm

Are you running .NET Memory Profiler as an elevated administrator? .NET Memory Profiler will list all available .NET processes, but it will not be able to attach to processes running under another account, unless you are running as an administrator.
Best regards,

Andreas Suurkuusk
SciTech Software AB

alqui
Posts: 2
Joined: Fri Jun 24, 2011 5:52 pm

Re: Attach to process

Post by alqui » Wed Jul 06, 2011 12:58 pm

Ok now it worked on my local machine. I tested it to see how it works and I thought I was ready to test it on a live process on my production server.

Problem is, when I take a snapshot on my production server, it shows nothing :?

I click on Collect Heap Snapshot. It starts normally but it stops pretty fast and then...nothing. I see no instance, no data, niet, not even an error message or something that could help me understand why there is nothing.

In the ShowSnapshot dropdownlist, I can see that my snap shot is there with the date.

How is this possible ? I can see in the task manager that the process is 250Mb so there must be something.

In the bottom of the application, I can see this :

Number of live instances : 0, Instance data byte collected : 0.

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Re: Attach to process

Post by Andreas Suurkuusk » Thu Jul 07, 2011 7:51 pm

When attaching to a pre-.NET 4.0 process (using the Windows Debugging Tools), no synchronization is performed with the profiled process when collecting a snapshot. Unfortunately, this can cause the snapshot to be collected while instances are moved in memory during a GC. In this case the profiler cannot retrieve any managed heap information. The current version will not detect this problem and an empty snapshot will be collected. If possible, try to collect snapshot while the process is not heavily allocating new instances. This will increase the possibility that the snapshot will not be collected while instances are being moved.

If you can change the process to run under .NET 4.0 instead and attach using the profiling API, this problem will not exist (provided that you use .NET Memory Profiler 4.0).
Best regards,

Andreas Suurkuusk
SciTech Software AB

nitin_bt

Re: Attach to process

Post by nitin_bt » Tue Nov 22, 2011 8:41 am

Hi All,

I am getting message "Attached failed. A profiler is already attached to process" whenever I tried "Attach to running process" and then selected w3wp.exe.

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Re: Attach to process

Post by Andreas Suurkuusk » Wed Nov 23, 2011 9:18 pm

Only one profiler can be attached to a .NET process at any one time. The message you are seeing indicates that there's a profiler still attached to the process you are trying to attach to, either .NET Memory Profiler or another profiler. When you stop profiling an attached process, .NET Memory Profiler will detach from the profiled process, and you will be able to attach a new profiler. However, if you have used another profiler which does not detach correctly, or if .NET Memory Profiler has crashed while profiling, you will not be able to re-attach to the process.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 21 guests