public final class HeapMonitor extends Object implements Closeable
The HeapMonitor only tracks allocations while the heap monitor is
collecting data. This means that allocations that were performed
while the heap monitor was not collecting data are not tracked.
Usage example: HeapMonitorSnippets.example()
HeapMonitor.takeSummary(),
HeapMonitor.takeMetaObjectSummary()| Modifier and Type | Method and Description |
|---|---|
void |
clearData()
Erases all the data gathered by the
HeapMonitor. |
void |
close()
Closes the
HeapMonitor for further use, deleting all the gathered data. |
static HeapMonitor |
find(org.graalvm.polyglot.Engine engine)
Returns the
HeapMonitor associated with a given engine. |
boolean |
hasData()
|
boolean |
isCollecting()
Returns
true if the heap monitor is collecting data, else false. |
void |
setCollecting(boolean collecting)
Controls whether the
HeapMonitor is collecting data or not. |
Map<com.oracle.truffle.api.nodes.LanguageInfo,Map<String,HeapSummary>> |
takeMetaObjectSummary()
Returns a summary of the current state of the heap grouped by language and meta object name.
|
HeapSummary |
takeSummary()
Returns a summary of the current state of the heap.
|
public static HeapMonitor find(org.graalvm.polyglot.Engine engine)
HeapMonitor associated with a given engine.engine - the engine to find debugger forHeapMonitorpublic void setCollecting(boolean collecting)
HeapMonitor is collecting data or not.collecting - the new state of the monitor.IllegalStateException - if the heap monitor was already closedpublic boolean isCollecting()
true if the heap monitor is collecting data, else false.public HeapSummary takeSummary()
The HeapMonitor only tracks allocations while the heap monitor is
collecting data. This means that allocations that were
performed while the heap monitor was not collecting data are not tracked.
IllegalStateException - if the heap monitor was already closedpublic Map<com.oracle.truffle.api.nodes.LanguageInfo,Map<String,HeapSummary>> takeMetaObjectSummary()
The HeapMonitor only tracks allocations while the heap monitor is
collecting data. This means that allocations that were
performed while the heap monitor was not collecting are ignored. In other words the
HeapMonitor reports snapshots as if the heap was completely empty when it was
"enabled".
IllegalStateException - if the heap monitor was already closedpublic void clearData()
HeapMonitor.public boolean hasData()
public void close()
HeapMonitor for further use, deleting all the gathered data.close in interface Closeableclose in interface AutoCloseable