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

Constructor Summary
LTMemory(long initialSizeInBytes, long maxSizeInBytes)
          Create an LTMemory of the given size.
LTMemory(long initialSizeInBytes, long maxSizeInBytes, java.lang.Runnable logic)
          Create an LTMemory of the given size and logic.
LTMemory(SizeEstimator initial, SizeEstimator maximum)
          Creates a LTMemory of the given size estimated by two instances of SizeEstimator.
LTMemory(SizeEstimator initial, SizeEstimator maximum, java.lang.Runnable logic)
          Creates a LTMemory of the given size estimated by two instances of SizeEstimator and logic.
 
Method Summary
 long getMaximumSize()
          Return the value which defines the maximum size to which this can grow.
 java.lang.String toString()
          Returns a user-friendly representation of this ScopedMemory.
 
Methods inherited from class javax.realtime.ScopedMemory
enter, enter, getPortal, getReferenceCount, join, join, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, setPortal
 
Methods inherited from class javax.realtime.MemoryArea
executeInArea, getMemoryArea, memoryConsumed, memoryRemaining, newArray, newInstance, newInstance, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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)
Create an LTMemory of the given size and logic.
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(SizeEstimator initial,
                SizeEstimator maximum)
Creates a LTMemory of the given size estimated by two instances of SizeEstimator.
Parameters:
initial - The instance of SizeEstimator which will set the initial allocation allocate for this area.
maximum - The instance of SizeEstimator which will set the maximum allocation allocate for this area.

LTMemory

public LTMemory(SizeEstimator initial,
                SizeEstimator maximum,
                java.lang.Runnable logic)
Creates a LTMemory of the given size estimated by two instances of SizeEstimator and logic.
Parameters:
initial - The instance of SizeEstimator which will set the initial allocation allocate for this area.
maximum - The instance of SizeEstimator which will set the maximum allocation allocate for this area.
logic - The logic associated with this.
Method Detail

getMaximumSize

public long getMaximumSize()
Return the value which defines the maximum size to which this can grow.
Overrides:
getMaximumSize in class ScopedMemory
Following copied from class: javax.realtime.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
Following copied from class: javax.realtime.ScopedMemory
Returns:
The string representation