Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get heap memory used for a required method?


How to get heap memory used for a required method?



A Method does not use any heap directly, do you mean the heap memory used for all objects created by a certain method?

Dynatrace Champion
Dynatrace Champion

heap memory and method executions are two completely unrelated concepts.

of course you could be interested in how much memory a method is allocating by its code on the heap. however, it's impossible to tell at that point in time when this memory will be freed or who is responsible for keeping the objects in the heap alive so they will not be garbage collected.

you could work with the memory sensors and show the allocations on the PurePath to get an idea about how many allocations of specific classes happen in a specific method, but I would not recommend this both from a complexity and performance point of view. also it would not show you how much heap memory is effectively allocated, which is hard to impossible to figure out with the Java/.NET memory model.

also I don't think that this kind of information will really help you find potential memory problems or allocation hotspots.

I would rather suggest to go through the documentation about memory diagnosis and the related information and videos you can find there:

HTH, Christian