Class ODirectMemoryAllocator

java.lang.Object
com.orientechnologies.common.directmemory.ODirectMemoryAllocator
All Implemented Interfaces:
ODirectMemoryAllocatorMXBean

public class ODirectMemoryAllocator extends Object implements ODirectMemoryAllocatorMXBean
Manages all allocations/deallocations from/to direct memory. Also tracks the presence of memory leaks.
See Also:
  • Constructor Details

    • ODirectMemoryAllocator

      public ODirectMemoryAllocator()
  • Method Details

    • instance

      public static ODirectMemoryAllocator instance()
      Returns:
      singleton instance.
    • allocate

      public OPointer allocate(int size, boolean clear, MemTrace intention)
      Allocates chunk of direct memory of given size.
      Parameters:
      size - Amount of memory to allocate
      clear - clears memory if needed
      intention - Why this memory is allocated. This parameter is used for memory profiling.
      Returns:
      Pointer to allocated memory
      Throws:
      ODirectMemoryAllocationFailedException - if it is impossible to allocate amount of direct memory of given size
    • deallocate

      public void deallocate(OPointer pointer)
      Returns allocated direct memory back to OS
    • getMemoryConsumption

      public long getMemoryConsumption()
      Specified by:
      getMemoryConsumption in interface ODirectMemoryAllocatorMXBean
      Returns:
      Amount of direct memory allocated using this allocator
    • checkMemoryLeaks

      public void checkMemoryLeaks()
      Verifies that all pointers which were allocated by allocator are freed.
    • checkTrackedPointerLeaks

      public void checkTrackedPointerLeaks()
      Checks reference queue to find direct memory leaks
    • id

      public static int id(Object object)