How to profile object creation in Java?
        Posted  
        
            by gooli
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by gooli
        
        
        
        Published on 2010-03-16T18:29:21Z
        Indexed on 
            2010/03/16
            18:31 UTC
        
        
        Read the original article
        Hit count: 277
        
The system I work with is creating a whole lot of objects and garbage collecting them all the time which results in a very steeply jagged graph of heap consumption. I would like to know which objects are being generated to tune the code, but I can't figure out a way to dump the heap at the moment the garbage collection starts. When I tried to initiate dumpHeap via JConsole manually at random times, I always got results after GC finished its run, and didn't get any useful data.
Any notes on how to track down excessive temporary object creation are welcome.
© Stack Overflow or respective owner