A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/darcysaum/heapaudit below:

GitHub - darcysaum/heapaudit

HeapAudit is a java agent which audits heap allocations for JVM processes.

HeapAudit runs in two modes:

Building the HeapAudit java agent

Build project with Maven:

The built jar will be in 'target/'.

Implementing the HeapAudit hook

Currently, two recorders are provided with HeapAudit:

Both of the above inherit from the base class HeapRecorder. Additional recording behavior can be extended by implementing the record method in HeapRecorder.

class MyRecorder extends HeapRecorder {

    @Override public void record(String name,
                                 int count,
                                 long size) {

        System.out.println("Allocated " + name +
                           "[" + count + "] " + size + " bytes");

    }

}

Recording starts when it is registered and stops when it is unregistered. Each recorder can be registered globally across all threads or local to the current.

MyRecorder r = new MyRecorder();

HeapRecorder.register(r, false);

MyObject o = new MyObject();

HeapRecorder.unregister(r, false);
Launching the HeapAudit java agent

Launch HeapAudit statically along with the process of interest (requires MyTest to implement the integration hook to register heap recorders).

$ java -javaagent:heapaudit.jar MyTest

Launch HeapAudit dynamically by attaching to the process of interest (does not require MyTest to have any prior intrumentations).

$ java -jar heapaudit.jar 999 -Icom/foursquare/test/MyTest@test.+

$ java -jar heapaudit.jar 999 -Rcom/foursquare/test/MyTest@test.+

The JDK's tools.jar library is required to launch HeapAudit dynamically. If launching within JRE, specify the -Xbootclasspath command line arg to point to the tools.jar file.

$ java -Xbootclasspath/a:/usr/local/lib/tools.jar -jar heapaudit.jar 999 -Icom/foursquare/test/MyTest@test.+

Additional options can be passed to HeapAudit to customize which classes and/or methods are not to be instrumented for recording allocations. For additional information on how to specify the options, see HeapSettings.java.

$ java -javaagent:heapaudit.jar="-Acom/foursquare/test/.+" MyTest

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4