Class HessianFreeList<T>


  • public final class HessianFreeList<T>
    extends Object
    FreeList provides a simple class to manage free objects. This is useful for large data structures that otherwise would gobble up huge GC time.

    The free list is bounded. Freeing an object when the list is full will do nothing.

    • Constructor Detail

      • HessianFreeList

        public HessianFreeList​(int size)
        Create a new free list.
        Parameters:
        initialSize - maximum number of free objects to store.
    • Method Detail

      • allocate

        public T allocate()
        Try to get an object from the free list. Returns null if the free list is empty.
        Returns:
        the new object or null.
      • free

        public boolean free​(T obj)
        Frees the object. If the free list is full, the object will be garbage collected.
        Parameters:
        obj - the object to be freed.
      • allowFree

        public boolean allowFree​(T obj)
      • freeCareful

        public void freeCareful​(T obj)
        Frees the object. If the free list is full, the object will be garbage collected.
        Parameters:
        obj - the object to be freed.
      • checkDuplicate

        public boolean checkDuplicate​(T obj)
        Debugging to see if the object has already been freed.