public final class AllocationEvent extends Object
Modifier and Type | Method and Description |
---|---|
LanguageInfo |
getLanguage()
Returns the language performing the allocation.
|
long |
getNewSize()
Returns a size of the allocated value in bytes.
|
long |
getOldSize()
Returns an old size of the value prior to the allocation, in bytes.
|
Object |
getValue()
Returns the value which is a subject of allocation.
|
public LanguageInfo getLanguage()
public long getOldSize()
0
when a new value is to be allocated, or the size of the value prior to the re-allocation.
When the old size is unknown, AllocationReporter.SIZE_UNKNOWN
is returned.public long getNewSize()
AllocationListener.onEnter(com.oracle.truffle.api.instrumentation.AllocationEvent)
an
estimated size of the allocated value is provided. When called from
AllocationListener.onReturnValue(com.oracle.truffle.api.instrumentation.AllocationEvent)
a corrected size can be provided, which might differ from the one reported in
onEnter
. When the allocated size is unknown, AllocationReporter.SIZE_UNKNOWN
is
returned. The change in memory consumption caused by the allocation is
AllocationEvent.getNewSize()
- AllocationEvent.getOldSize()
when both old size and new size
are known. The change can be either positive or negative.public Object getValue()
AllocationListener.onEnter(com.oracle.truffle.api.instrumentation.AllocationEvent)
the returned value is either null
when a new one is to be allocated, or non-
null
when the value is to be re-allocated. When called from
AllocationListener.onReturnValue(com.oracle.truffle.api.instrumentation.AllocationEvent)
it is always non-null
and it is either the newly allocated value, or the same
instance of the re-allocated value as was provided in the preceding call to
AllocationListener.onEnter(com.oracle.truffle.api.instrumentation.AllocationEvent)
.