Hello Heisenberg: Memory Profiling Changes App Behavior

I am currently stress testing a long-running (Windows service) application trying to find memory leaks. What I have done up to this point was run the Windows Performance Monitor with a few key metrics, including Generation 2 Heap Size. After running the app all weekend I noticed that this counter had grown beyond my comfort zone, so I decided to profile it with ANTS.

What I have noticed is that the Gen 2 Heap Size doesn't seem to grow as it does when the app isn't being profiled. Can anyone think of an explanation?

Windows XP Professional SP 2
.NET Framework 1.1
Dell Optiplex GX620
2.8 GHz PROCESSOR (80551, Pentium D Smithfield for desktops)
1 GB RAM

Thanks in advance,

Mike

Comments

  • I may have a possible explanation. After running the profile all night, it appears that the Gen 2 Heap does still grow. Apparently it's just far slower, possibly due to the overhead of profiling.

    Mike
  • What a great tool. I was able to identify a disposable object that wasn't being disposed, which was the cause of the runaway memory utilization.

    I have noticed that the Garbage Collector seems much more active when the app is being profiled. Why is this?

    Mike
  • Hi there,

    I'm really pleased to hear that ANTS profiler really helped you track down that memory leak. I'd be really interested to hear the details so that we could write up a case study. If this is something that would be of interest, just send a mail through to support@redgate.com. We'd happily give you some free software in return for your effort :)

    I look forward to hearing from you.

    Best regards,

    Tom Harris

    Red Gate Software
  • Was this case study ever written or more information gathered? I appear to be witnessing a Heisenberg effect with my profiling as well. Actually, I would say this is more of a Hawthorne Effect than Heisenberg. I have been trying to track down a memory leak within a .NET Windows Service.

    The VM size grows and grows and the service processes a flow of data from an MSMQ. When I turned ANTS profiler on for this service, however, the VM size became bounded at around 45MB, where it had grown over 100MB without the profiler. The number of objects also stabilizes.

    I did a little digging and thought it may be because of the forced GC that the profiler does before capturing a snapshot. But even with my addition of a call to the GC to Collect, my memory still grows when I'm not profiling. I'm baffled but I certainly don't understand .NET garbage collection backwards and forwards yet. Just wanted some help understanding why the profiler might be behaving in this way.

    I'm running the ANTS 2.7.0.109 free trial. On Windows XP SP2 on a Compaq laptop.
Sign In or Register to comment.