javax.realtime
Class LTMemory
java.lang.Object
|
+--javax.realtime.MemoryArea
|
+--javax.realtime.ScopedMemory
|
+--javax.realtime.LTMemory
- public class LTMemory
- extends ScopedMemory
LTMemory
represents a memory area, allocated per
RealtimeThread
, or for a group of real-time threads,
guaranteed by the system to have linear time allocation. 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 memory area
associated with a NoHeapRealtimeThread
, or to enter the
memory area using the ScopedMemory.enter()
method within a
NoHeapRealtimeThread
. An LTMemory
area has an
initial size. Enough memory must be committed by the completion of
the constructor to satisfy this initial requirement. (Committed means
that this memory must always be available for allocation). The
initial 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. (Note: It is important to understand that the above statement
does not require that if the initial memory size is N and
(sizeof(object1) + sizeof(object2) + ... + sizeof(objectn) = N)
the allocations of objects 1 through n will necessarily succeed.)
Execution time of an allocator allocating from this initial area must
be linear in the size of the allocated object. Execution time of an
allocator allocating from memory between initial and maximum is
allowed to vary. Furthermore, the underlying system is not required
to guarantee that memory between initial and maximum will always be
available. (Note: to ensure that all requested memory is available
set initial and maximum to the same value)
- See Also:
MemoryArea
,
ScopedMemory
,
RealtimeThread
,
NoHeapRealtimeThread
Method Summary |
long |
getMaximumSize()
Get the maximum size this memory area can attain. |
java.lang.String |
toString()
Returns a user-friendly representation of this ScopedMemory . |
Methods inherited from class javax.realtime.ScopedMemory |
enter,
enter,
finalize,
getPortal,
getReferenceCount,
join,
join,
joinAndEnter,
joinAndEnter,
joinAndEnter,
joinAndEnter,
setPortal |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
LTMemory
public LTMemory(long initialSizeInBytes,
long maxSizeInBytes)
- Create an
LTMemory
of the given size.
- Parameters:
initialSizeInBytes
- The size in bytes of the memory to
allocate for this area. This memory must be committed
before the completion of the constructor.maxSizeInBytes
- The size in bytes of the memory to
allocate for this area.
LTMemory
public LTMemory(long initialSizeInBytes,
long maxSizeInBytes,
java.lang.Runnable logic)
LTMemory
public LTMemory(SizeEstimator initial,
SizeEstimator maximum)
LTMemory
public LTMemory(SizeEstimator initial,
SizeEstimator maximum,
java.lang.Runnable logic)
getMaximumSize
public long getMaximumSize()
- Description copied from class: ScopedMemory
- Get the maximum size this memory area can attain. If this is
a fixed size memorea area, the returned value will be equal
to the initial size.
- Overrides:
- getMaximumSize in class ScopedMemory
- Tags copied from class: ScopedMemory
- Returns:
- The maximum size attainable.
toString
public java.lang.String toString()
- Description copied from class: ScopedMemory
- Returns a user-friendly representation of this
ScopedMemory
.
- Overrides:
- toString in class ScopedMemory
- Tags copied from class: ScopedMemory
- Returns:
- The string representation