com.jrockit.memleak.util
Class MemLeakAdapter

Adapter to simplify implementation of IMemLeak.
FIXME: All unimplemented methods should throw
UnsupportedOperationException.
FIXME: Make abstract? If so, easier to
forget adding new IMemLeak methods.
FIXME: Some of the comments below should probably be included in the contract
of the IMemLeak interface.

MemLeakAdapter

deleteObjectId

FIXME: Fix comments, rename to dropRef() or similar. Delete the given
object ID. Every object (or class) ID returned from the other methods
must be deleted exactly once. Once deleted, an ID may be reused at any
time.

pollDiscardedObjects

If supported, poll the server for objects (and classes) that have been garbage collected.
All INotificationService listeners will be notified with IObjectInfos and IClassInfos for any GC:d objects.
This will also prevent those infos from being reachable from this SPI.

Enable traces for allocations of a certain type. This will cause all
methods that allocate objects of this type to be recompiled with
instrumentation. Traces can only be enabled for one type at a time.

Enable traces for allocations of a certain type. This will cause all
methods that allocate objects of this type to be recompiled with
instrumentation. Traces can only be enabled for one type at a time.

The returned array will be no larger than maxRelations (it
may be smaller if there are fewer relations).

The returned array will be sorted on the keep-alive-size. This means that
if keep-alive-sizes are calculated, and maxRelations is also set, only
the instances with the highest keep-alive-size will be returned.

If stopAt is >= 0 the maximum keep-alive-size reported in
each IRelationshipInfo will be stopAt (this is to
limit the amount of objects traversed to find the size). Specifying zero
will effectively disable the keep-alive-size calculation, and the array
will effectively be unsorted.

If stopAt is IMemLeak.UNLIMITED_SIZE, there is no max for
keep-alive-size, which means the actual keep-alive-size will be returned.

maxRelations - maximum number of relations to return. To return all
relations, use IMemLeak.UNLIMITED_INSTANCES (this can possibly
return a very large array).

stopAt - the limit in bytes for keep alive size calculation, see above

maxMillis - specifies the maximum amount of time (in milliseconds) the
server should spend completing the request. If more time has
elapsed the server will stop processing the request and return
the data as it is at that time. A value of IMemLeak.FOREVER
means infinite time.

The returned array will be no larger than maxRelations (it
may be smaller if there are fewer relations).

The returned array will be sorted on the keep-alive-size. This means that
if keep-alive-sizes are calculated, and maxRelations is also set, only
the instances with the highest keep-alive-size will be returned.

If stopAt is >= 0 the maximum keep-alive-size reported in
each IRelationshipInfo will be stopAt (this is to
limit the amount of objects traversed to find the size). Specifying zero
will effectively disable the keep-alive-size calculation, and the array
will effectively be unsorted.

If stopAt is IMemLeak.UNLIMITED_SIZE, there is no max for
keep-alive-size, which means the actual keep-alive-size will be returned.

maxRelations - maximum number of relations to return. To return all
relations, use IMemLeak.UNLIMITED_INSTANCES (this can possibly
return a very large array).

stopAt - the limit in bytes for keep alive size calculation, see above

maxMillis - specifies the maximum amount of time (in milliseconds) the
server should spend completing the request. If more time has
elapsed the server will stop processing the request and return
the data as it is at that time. A value of IMemLeak.FOREVER
means infinite time.

Find a path from a GC root to the object denoted by
objectSpec. Note that maxDepth is interpreted
in such a way that if there's any root at most this many steps away, a
root will always be returned. However, roots further away may still be
reported due to implementation details. Perhaps minDepth or simply depth
would be a better parameter name.

getLargestArrays

Get the 10 largest arrays on the heap. If the given array type does not
have any instances, but is loaded, a zero length array is returned. If
the type isn't loaded, or doesn't exist, a reason of
ITruncatable.Reason.EMPTY_REPLY is returned. (Since no
classloader is specified, these last two cases are not easily
differentiated.) Non-array types may give a NotAnArrayException as
reason.

getLargestArrays

Get the 10 largest arrays on the heap. If the given array type does not
have any instances, but is loaded, a zero length array is returned. If
the type isn't loaded, or doesn't exist, a reason of
ITruncatable.Reason.EMPTY_REPLY is returned. (Since a class
loader may or may not be specified, these last two cases are not easily
differentiated.) Non-array types may give a NotAnArrayException as
reason.

getMetaData

Obtain meta data for this connection. The keys are either META_*
constants of this interface or implementation specific. Implementations
unaware of the given key (including META_* constants) should return null.
Used mainly for diagnostic purposes.

setAllocTraceFrequency

Changes the number of allocations that has to occur before an allocation
trace will be reported.

Gathering every allocation trace is sometimes (most times) too expensive.
By skipping a number of allocations before reporting, the cost will be
reduced. For example, an interval value of 1 will report every
allocation, 2 will report every other allocation, and 30 will report
every 30th allocation.

setDisconnectCallback

Sets the callback called if we're disconnected because communication with
the server fails. Note that this callback is only called when the
communication fails. Normal, client initiated, termination of the
communication will not result in the disconnect callback being called.

This likely won't have any effect for implementations that doesn't
require any external state.

setHistogramCutoff

Set the cutoff point for types in the heap histograms (applicable both to
getHeapHistogram and setTrendAnalysisEnabled). Types which occupy less
than this much of the total heap will not be shown in the histograms. 1.0
cuts off everything. 0 doesn't cut off anything.

histogramCutoff - Which types to leave out of the histograms. 0 means including
all types, 0.05 means including types occupying more than 5
percent of the heap, and 1 effectively means disregarding all
types.

Throws:

java.lang.IllegalArgumentException - if the cutoff is less than zero or larger than 1.