How to debug memory usage in java programs (minecraft)?

keybounce

New Member
Jul 29, 2019
1,925
0
0
I want to start looking over tenured memory for things that have been there for a very long time.

Reason: My pack is accumulating a lot of active memory over time.
Suspicion: Some mod data is being cached per-chunk, and not unloaded when the chunk is unloaded.

What I want to be able to do: Look over allocated objects that are survivors, and see what objects are increasing in count, and the reference chain from root objects to these objects. The expectation is that they will pass through hashmaps that tag on the world and chunk. By finding these objects, I should be able to tell which mod is leaking them.

But I have no idea what tool to use to begin to do this. I don't know if there are any debugging tools that can stamp objects with their time of allocation, so I can check for age as well as allocation chain.

Etc. Basically, C type languages have a specially malloc library for debugging memory leaks; I'm looking for that in Java.

(Seriously, how do you debug java programs? Eclipse is nice, but still leaves me wanting more.)