All Packages  This Package  Class Hierarchy  Class Search  Index

Class utah.npm.core.MemPool
java.lang.Object
   |
   +----utah.npm.core.Lockable
           |
           +----utah.npm.core.NPMObject
                   |
                   +----utah.npm.core.Refable
                           |
                           +----utah.npm.core.MemPool

  Summary

public final class  MemPool
     extends utah.npm.core.Refable
{
          // Fields 4
     private Reference keeperPort_;
     private static final byte[] outOfMemoryMessage;
     private Link pPoolLink_;
     private int vmPrivate_;

          // Constructors 3
     private MemPool();
     public MemPool(long, Reference, Reference, Reference);
     public MemPool(long, Reference, Reference, Reference, int);

          // Methods 15
     static String typeName();

     public void destroy();
     public long getAvailable();
     public long getSize();
     private boolean outOfMemoryException(int);
     void s_init(long, Reference, Reference, Reference, int);
     int s_newChild(MemPool, int);
     void s_removeChild(MemPool);
     int s_type();
     int s_vmPrivate();
     public String toString();
     private native void vmDestroy();
     private native long vmGetAvailable();
     private native long vmGetSize();
     private native long vmPoolInit(long, MemPool);
}

MemPool objects encapsulate management of a chunk of memory.

TODO: protocol for destroying mempool and reclaiming what memory we can, and giving that memory back to the parent pool...

Version:
NPMJava 0.5.0 April, 1998
Author:
Patrick Tullmann tullmann@cs.utah.edu




  Fields

· vmPrivate_

Summary  |  Top

   private int vmPrivate_


· outOfMemoryMessage

Summary  |  Top
   private static final byte[] outOfMemoryMessage


· pPoolLink_

Summary  |  Top
   private Link pPoolLink_


· keeperPort_

Summary  |  Top
   private Reference keeperPort_


  Constructors

· MemPool

Summary  |  Top

   public MemPool(long size, 
                  Reference pPoolRef, 
                  Reference spaceRef, 
                  Reference keeperPortRef) 

Create a MemPool of the requested size. The MemPool is associated with the given space, and gets its memory from the given parent MemPool. The KeeperPort is used to send requests for more memory and out of memory messages.

Parameter Description
size the requested initial size. Use the getSize() method to determine the size actually granted.
pPoolRef a Reference to the parent pool to allocate the space out of.
spaceRef a Reference to the space to associate this pool with.
keeperPortRef a Port Reference to which out of memory messages will be sent.



· MemPool

Summary  |  Top
   public MemPool(long size, 
                  Reference pPoolRef, 
                  Reference spaceRef, 
                  Reference keeperPortRef, 
                  int hashCode) 

Same as the previous constructor with the addition of the hashCode specification.



· MemPool

Summary  |  Top
   private MemPool() 

A special constructor used by the VM to bootstrap the root space.



  Methods

· s_init

Summary  |  Top
   void s_init(long size, 
               Reference pPoolRef, 
               Reference spaceRef, 
               Reference keeperPortRef, 
               int hashCode) 

Internal initialization of the MemPool. Creates the VM-internal MemPool, and initializes the links to other objects.

This function is called exactly once for each instance.

Parameter Description
size the intial (requested) size for the new mempool
pPoolRef a reference to the parent pool
spaceRef a reference to the space object to associate this pool with
keeperPortRef a reference to the keeper port to send mempool-related IPCs to
hashCode the hashCode value to associate with this object.



· vmPoolInit

Summary  |  Top
   private native long vmPoolInit(long size, 
                                  MemPool parentPool) 

Initialize this mem pool. This function is called exactly once from the constructor.

Parameter Description
size the requested size of the pool.
parentPool a pointer to the parent pool.

Returns:
the actual size allocated.


· vmGetSize

Summary  |  Top
   private native long vmGetSize() 

Get the total size of this mempool (in bytes).

Returns:
the total size of this mempool.


· vmGetAvailable

Summary  |  Top
   private native long vmGetAvailable() 

Get the available memory for this mempool.

Returns:
the available number of bytes in this mempool.


· vmDestroy

Summary  |  Top
   private native void vmDestroy() 

Perform VM-specific state cleanup (namely nuking all of the objects defined in this memPool.)



· outOfMemoryException

Summary  |  Top
   private boolean outOfMemoryException(int shortAmt) 

This method is called directly by the VM when a MemPool runs out of memory.

Parameter Description
shortAmt the amount the MemPool requires to satisfy the single outstanding request.



· getSize

Summary  |  Top
   public long getSize() 

Get the total size in bytes of this MemPool.

Returns:
the total size in bytes of the MemPool.


· getAvailable

Summary  |  Top
   public long getAvailable() 

Get the available number of bytes in this MemPool. This number is approximate as Garbage collection and the action of other threads can change the amount.

Returns:
the available number of byte in this MemPool.

See Also: getWatermark



· destroy

Summary  |  Top
   public void destroy() 

Destroy this mempool.

Overrides:
destroy in class Refable


· s_newChild

Summary  |  Top
   int s_newChild(MemPool child, 
                  int reqSize) 


· s_removeChild

Summary  |  Top
   void s_removeChild(MemPool child) 


· s_vmPrivate

Summary  |  Top
   int s_vmPrivate() 


· toString

Summary  |  Top
   public String toString() 
Overrides:
toString in class NPMObject


· typeName

Summary  |  Top
   static String typeName() 
Overrides:
typeName in class NPMObject


· s_type

Summary  |  Top
   int s_type() 
Overrides:
s_type in class NPMObject


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7