2014-08-06 17:15 GMT-04:00 Marc-André Laperle < marc-andre.lape...@ericsson.com>:
> Hi Francis, > > Did you have a specific reason to get the heap dump using code? > It allows to save the dump at a specific place in the code. > You should be able to acquire a Heap dump (hprof) from within MAT using > File > Acquire heap dump. VisualVm also can do that I believe (right-click > on process?). There is also the jmap command that can output a heap dump. > Just to save you some time for next time ;) > Yeah, but snapshot taken interactively are very cumbersome for batch jobs. I tried to put a sleep where I wanted the snapshot, and then go to the MAT UI and click, but I was feeling like mr bean[1] playing to the incredible machine[2]. But maybe I missed something? The dump can also be triggered by OutOfMemoryError by passing -XX:+HeapDumpOnOutOfMemoryError as VM argument, but it doesn't work by manual throw new OutOfMemoryError(). It must be done by the VM itself. Besides that, one of the issue is not to minimize the average memory, but also prevent high peak memory usage, because that may trigger the OutOfMemoryError. The Massif tool of Valgrind is able to record peak memory usages for C/C++. Does somebody knows if there is a way to monitor peaks memory usage in Java, ans possibly trigger a dump even if the OutOfMemoryError is not reached? Cheers, Francis [1] http://en.wikipedia.org/wiki/Mr_bean [2] http://en.wikipedia.org/wiki/The_Incredible_Machine_(series) > > Marc-Andre > > ------------------------------ > *From:* linuxtools-dev-boun...@eclipse.org [ > linuxtools-dev-boun...@eclipse.org] on behalf of Francis Giraldeau [ > francis.girald...@gmail.com] > *Sent:* Wednesday, August 06 2014 11:15 AM > *To:* Linux Tools developer discussions > *Subject:* [linuxtools-dev] Memory usage of TmfExperiment > > I used Eclipse Memory Analyzer (MAT) to find the object holding a > reference to a large temporary chunk of memory. It appears that > TmfExperiment is not AutoClosable as other traces, and calling dispose() > method on the experiment solved the issue. (Whole story: > http://multivax.blogspot.ca/2014/08/pinpoint-memory-usage-of-java-program.html > ) > > For the debugging, I needed the HeapDump class. However, I could not > find it in other linuxtools plug-ins, and I don't know how to search for > that class in p2 repo, such as Orbit. I think that would be very helpful to > have it in the class path. Here is the slightly modified version I have: > > > https://github.com/giraldeau/org.eclipse.linuxtools/blob/graph/lttng/org.eclipse.linuxtools.tmf.analysis.graph.core.tests/src/org/eclipse/linuxtools/tmf/analysis/graph/core/tests/staging/HeapDump.java > > Cheers, > > Francis > > _______________________________________________ > linuxtools-dev mailing list > linuxtools-dev@eclipse.org > To change your delivery options, retrieve your password, or unsubscribe > from this list, visit > https://dev.eclipse.org/mailman/listinfo/linuxtools-dev >
_______________________________________________ linuxtools-dev mailing list linuxtools-dev@eclipse.org To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/linuxtools-dev