Skip to content

Running

Jonathan Ross edited this page Jan 19, 2014 · 9 revisions

Trilby accepts several command-line options followed by a heap dump filename. Unless otherwise noted, Trilby runs an interactive session; see Queries for description of interactive commands. The most common command lines are

# For small heaps
% trilby heapfile.hprof

# For large heaps (set heap max roughly == dump size)
% trilby -Xmx10g --g1 --info heapfile.hprof

--genheap

Start a non-interactive session to generate a small heap file usable for functional testing and demos. Example:

% trilby --genheap
Generating smallheap.hprof with 10000 test objects
Ready to dump, sleeping
Dumping heap to /tmp/trilby/smallheap.hprof ...
Heap dump file created
Killing GenHeap & waiting
Done with smallheap.hprof

--g1

A synonym for -XX:+UseG1GC. May be helpful for larger heaps, since the CMS (the default for Trilby) does not take kindly to allocation of massive arrays. (ParallelScavenge is neither recommended nor supported; the compaction time for large heaps is prohibitive.)

--histo

Start a non-interactive session and simply generate a histogram a la jmap --histo (except that Trilby histograms also display retained sizes.) Example:

% trilby --histo smallheap.hprof | head -5
     40738     651808     651808 java.lang.Integer
     12022     480880    1087832 java.util.HashMap$Entry
     30000     480000     480000 trilby.util.Thing2
     10704     342528     276888 java.lang.String
     10000     320000     480000 trilby.util.Thing2[]

--info

Turns on INFO-level logging, which will output a variety of status information as Trilby reads the heap and processes queries.

--nodom

Don't generate the dominator tree. This saves considerable startup time on large heaps, but precludes dominator queries or display of retained sizes.

--offheap

(Experimental, may be removed.) Move certain large structures into direct byte buffers instead of allocating them on the heap. This option may be helpful if raising the max heap size doesn't resolve an out-of-memory error.

-anything

Any option that begins with a single dash is passed as-is to the JVM. For example, you can set the max heap size with -Xmx.

Clone this wiki locally