ANTS Memory Profiler 7

Understanding ANTS Memory Profiler

Recommendations

Finding your memory problem may require some detective work; we recommend that, before using ANTS Memory Profiler, you should have the following:

  1. Good knowledge of your code.
  2. An idea of where in your code your problem might be occurring.
  3. An understanding of how .NET memory management works.

If you have a leak in managed memory, it is likely that you are leaking more than one object:

  • Your object, which is kept in memory because of this leak.
  • Objects in classes from the CLR itself, which are referenced by your object.

If your leaked object contains text, for example, at least one System.String object will also be kept in memory. Your object may only be a few bytes large, but it may be holding a significant amount of memory in classes from the CLR.

Conversely, this means that when you are looking for leaked objects in your code using ANTS Memory Profiler, it is often useful to start by looking at these classes inherited from the CLR, rather than starting from your own classes.

Remember also that no program can decide whether or not an object is a leak, because it depends on the nature of the program you are profiling. If a large number of strings are kept in memory for a long time in word processing software, this may not be an indicator of a problem. However, if strings from a dialog box that has been closed are kept in memory in a graphics program, this could be a good place to start the investigation. Ultimately, therefore, you will need to use knowledge of your code to interpret the information shown in ANTS Memory Profiler.


Didn't find what you were looking for?