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.longReturns a size of the allocated value in bytes.longReturns 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
-
getOldSize
public long getOldSize()Returns an old size of the value prior to the allocation, in bytes. Returns0when 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_UNKNOWNis 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_UNKNOWNis returned. The change in memory consumption caused by the allocation iswhen 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 eithernullwhen a new one is to be allocated, or non-nullwhen the value is to be re-allocated. When called fromAllocationListener.onReturnValue(com.oracle.truffle.api.instrumentation.AllocationEvent)it is always non-nulland 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
-