To analyze memory leak issue for .NET application, I am
following approach explained in ‘Memory diagnostics for Java & .NET’ video
tutorial by Andy.
Followed process is as below-
From Memory Usage Trend, we observed that
almost ~400 MB memory is getting leaked.
3.Moving ahead, we took ‘Diagnose Runtime >
Total Memory > Create Memory Snapshot > Deep Memory Leak Analysis’
snapshot to find classes, object and references to search large objects and
their keeping alive paths.
To drill down this information further, can
we get details of objects consuming memory and the
class / method name where the objects are referred?
4.To find method details, we analyzed ‘Methods’
which were active when Total Memory snapshots taken. However we cannot conclude
more details for memory details of particular objects, classes and methods.
5.Post studying, all the information available in
documents, forum to sort required details; we created Memory Sensors for eNSRC method and placed it across
respective agents to capture memory details however we could retrieve –
Type | Class | Instances | Allocating Class | Allocating Method | File
| Line | Agent
With this approach, details about
memory used by particular objects and referring class, methods are still unavailable
to us which can be hand over to developers to amend certain code, so that
memory leak issue will be resolved, please let me know how can that details be
Or is there any other way to find
same details? Please assist to sort out this requirement.
Aniket, Thanks for that detail.
In step 1, i'm not sure i see a pattern of a memory leak, as it appears the total memory consumed did not grow. Perhaps you need to take snapshots across a larger timeframe more than 25 minutes?
The rest of the methodology steps depend on the type of problem you are chasing, whether it is a leak or perhaps simply excessive object creation/destruction, or possibly simply too many large objects, but stable. Perhaps I misunderstood why you concluded you have a memory leak, which is normally observable by continually increasing level of memory consumption.
In that case I have to follow 'simply excessive object creation/destruction, or possibly simply too many large objects, but stable' scenario which you have mentioned. So, prospective to this scenario; can I trace down details of memory used by particular objects and referring class, methods?
Aniket, Excessive GC activity would indicate that you have excessive object creation/destruction events. But there's no screenshots indicating excessive GC, so I don't know.
To pursue the Too Many Large Object theory, I would expect your heap to be excessively large, but it does not seem excessive. However I don't know your expectation. But to pursue this type of problem I would inspect the Instance Count and GC Size columns. But be careful as an object such as String is not necessarily your problem but perhaps it's the object that itself contains strings. So this is where it can be helpful to look at the Keep Alive paths and see why you have so many String objects. Perhaps String is a child object of Address which is a child object of Person and theres a Collection of Person objects that's being kept alive unnecessarily. Hopefully this makes sense.
I agree with Joe. There doesnt seem to be a real memory leak. You should try to run longer tests and take more snapshots. You can also try to run the snapshots with the option "Force GC" so that you really only get to see objects that remain on the heap -> that would make it easier to hunt real memory leaks.
if you want to find out where certain objects get allocated simply create Memory Sensor Rules for those objects that you want to trace back to a PurePath. Just be careful to pick objects that are not getting created in the millions, e.g: String objects.