Page 1 of 1

Attach to process

Posted: Fri Jun 24, 2011 5:57 pm
by alqui

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.

Re: Attach to process

Posted: Sun Jun 26, 2011 9:06 pm
by Andreas Suurkuusk
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.

Re: Attach to process

Posted: Wed Jul 06, 2011 12:58 pm
by alqui
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.

Re: Attach to process

Posted: Thu Jul 07, 2011 7:51 pm
by Andreas Suurkuusk
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).

Re: Attach to process

Posted: Tue Nov 22, 2011 8:41 am
by nitin_bt
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.

Re: Attach to process

Posted: Wed Nov 23, 2011 9:18 pm
by Andreas Suurkuusk
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.