public class LTMemory extends ScopedMemory
LTMemory represents a memory area guaranteed by the
system to have linear time allocation when memory consumption from
the memory area is less than the memory area's size.
The memory area described by a LTMemory instance
does not exist in the Java heap, and is not subject to garbage
collection. Thus, it is safe to use a LTMemory object as
the initial memory area for a Schedulable
instance which may not use the HeapMemory
or to enter the memory area using the ScopedMemory.enter()
method within such an instance.
Enough memory must be committed by the completion of the
constructor to satisfy the memory requirement given in the constructor.
Committed means that this memory must always be available for allocation.
The memory allocation must behave, with respect to successful
allocation, as if it were contiguous; i.e., a correct implementation
must guarantee that any sequence of object allocations that could
ever succeed without exceeding a specified initial memory size will
always succeed without exceeding that initial memory size and succeed
for any instance of LTMemory with that initial memory
size.
Creation of an LTMemory shall fail with a
StaticOutOfMemoryError when the current
Schedulable has been configured with a
ScopedMemoryParameters.getMaxGlobalBackingStore() that would be
exceeded by said creation.
Methods from LTMemory should be overridden only by methods
that use super.
MemoryArea,
ScopedMemory,
Schedulable| Constructor and Description |
|---|
LTMemory(long size)
Equivalent to
LTMemory(long, Runnable) with the argument list
((size, null). |
LTMemory(long size,
java.lang.Runnable logic)
Create a scoped memory of the given size and with the give logic to
run upon entry when no other logic is given.
|
LTMemory(SizeEstimator size)
Equivalent to
LTMemory(long, Runnable) with argument list
(size.getEstimate(), null). |
LTMemory(SizeEstimator size,
java.lang.Runnable logic)
Equivalent to
LTMemory(long, Runnable) with argument list
(size.getEstimate(), runnable). |
enter, enter, enter, enter, enter, enter, enter, executeInArea, executeInArea, executeInArea, executeInArea, executeInArea, executeInArea, finalize, getParent, getPortal, getReferenceCount, globalBackingStoreConsumed, globalBackingStoreRemaining, globalBackingStoreSize, join, join, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, newArray, newInstance, newInstance, setPortal, toString, visitNestedScopes, visitScopeRootsgetMemoryArea, mayHoldReferenceTo, mayHoldReferenceTo, memoryConsumed, memoryRemaining, newArrayInArea, sizepublic LTMemory(long size,
java.lang.Runnable logic)
size - The size in bytes of the memory to
allocate for this area. This memory must be committed
before the completion of the constructor.logic - The run() of the given
Runnable will be executed using
this as its initial memory area. When
logic is null, this constructor is
equivalent to LTMemory(long).StaticIllegalArgumentException - when size
is less than zero.StaticOutOfMemoryError - when there is
insufficient memory for the LTMemory object or for
its allocation area in its backing store, or when the
current Schedulable would exceed its configured
allowance of global backing store.IllegalAssignmentError - when storing
logic in this would violate the assignment
rules.public LTMemory(SizeEstimator size, java.lang.Runnable logic)
LTMemory(long, Runnable) with argument list
(size.getEstimate(), runnable).size - An instance of SizeEstimator
used to give an
estimate of the initial size.
This memory must be committed
before the completion of the constructor.logic - The run() of the given
Runnable will be executed using
this as its initial memory area. When
logic is null, this constructor is
equivalent to LTMemory(SizeEstimator).StaticIllegalArgumentException - when
size is null.StaticOutOfMemoryError - when there is
insufficient memory for the LTMemory object or for
its allocation area in its backing store, or when the
current Schedulable would exceed its configured
allowance of global backing store.IllegalAssignmentError - when storing
logic in this would violate the assignment
rules.public LTMemory(long size)
LTMemory(long, Runnable) with the argument list
((size, null).size - The size in bytes of the memory to
allocate for this area. This memory must be committed
before the completion of the constructor.StaticIllegalArgumentException - when
size is less than zero.StaticOutOfMemoryError - when there is
insufficient memory for the LTMemory object or for its
allocation area in its backing store, or when the current
Schedulable would exceed its configured allowance of
global backing store.public LTMemory(SizeEstimator size)
LTMemory(long, Runnable) with argument list
(size.getEstimate(), null).size - An instance of SizeEstimator
used to give an estimate of the initial size.
This memory must be committed
before the completion of the constructor.StaticIllegalArgumentException - when
size is null.StaticOutOfMemoryError - when there is
insufficient memory for the LTMemory object, or when
the current Schedulable would exceed its configured
allowance of global backing store.