public interface Heap { int acquire (int size); int release (int offset); int fetch (int offset); void store (int offset, int value); }The acquire method allocates a region of size consecutive ints in the array and returns the offset of the first byte in the region. The release method release a region of ints at the specified offset which was obtained previously using acquire. The fetch method is used to read a value from the array at the given offset and the store method writes a value into the array at the given offset.
public interface Handle { int getSize (); int fetchInt (int offset); Handle fetchReference (int offset); storeInt (int offset, int value); storeReference (int offset, Handle h); }A handle refers to an object that contains either ints or other handles. The size of an object is total the number of ints and handles it contains. The various store and fetch methods are used to insert and remove items from the object to which this handle refers.
public interface Heap { Handle acquire (int size); void release (Handle h); void collectGarbage (); }The acquire method allocates a handle and space in the heap for an object of the given size. The release method releases the given handle but does not reclaim the associated heap space. The collectGarbage method performs the actual garbage collection operation.