Class AllocationEvent
java.lang.Object
com.oracle.truffle.api.instrumentation.AllocationEvent
An event representing an allocation of a guest language value.
- Since:
- 0.27
-
Method Summary
Modifier and TypeMethodDescriptionReturns the language performing the allocation.long
Returns a size of the allocated value in bytes.long
Returns an old size of the value prior to the allocation, in bytes.getValue()
Returns the value which is a subject of allocation.
-
Method Details
-
getLanguage
Returns the language performing the allocation.- Since:
- 0.27
-
getOldSize
public long getOldSize()Returns an old size of the value prior to the allocation, in bytes. Returns0
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.- Since:
- 0.27
-
getNewSize
public long getNewSize()Returns a size of the allocated value in bytes. When called fromAllocationListener.onEnter(com.oracle.truffle.api.instrumentation.AllocationEvent)
an estimated size of the allocated value is provided. When called fromAllocationListener.onReturnValue(com.oracle.truffle.api.instrumentation.AllocationEvent)
a corrected size can be provided, which might differ from the one reported inonEnter
. When the allocated size is unknown,AllocationReporter.SIZE_UNKNOWN
is returned. The change in memory consumption caused by the allocation is
when both old size and new size are known. The change can be either positive or negative.getNewSize()
-getOldSize()
- Since:
- 0.27
-
getValue
Returns the value which is a subject of allocation. When called fromAllocationListener.onEnter(com.oracle.truffle.api.instrumentation.AllocationEvent)
the returned value is eithernull
when a new one is to be allocated, or non-null
when the value is to be re-allocated. When called fromAllocationListener.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 toAllocationListener.onEnter(com.oracle.truffle.api.instrumentation.AllocationEvent)
.- Since:
- 0.27
-