Interface MemoryRequestServer

All Known Implementing Classes:
DefaultMemoryRequestServer

public interface MemoryRequestServer
The MemoryRequestServer is a callback interface to provide a means to request more or less memory for heap and off-heap WritableMemory resources that are not file-memory-mapped backed resources.

Note: this only works with Java 21.

Author:
Lee Rhodes
  • Method Summary

    Modifier and Type
    Method
    Description
    request(WritableMemory oldWmem, long newCapacityBytes)
    Request a new WritableMemory with the given newCapacityBytes.
    void
    Request to close the given WritableMemory.
  • Method Details

    • request

      WritableMemory request(WritableMemory oldWmem, long newCapacityBytes)
      Request a new WritableMemory with the given newCapacityBytes.
      Parameters:
      oldWmem - the previous WritableMemory to be possibly closed and which provides an associated Arena that may be used for allocating the new WritableMemory. If the arena is null, the requested WritableMemory will be on-heap.
      newCapacityBytes - The capacity being requested.
      Returns:
      new WritableMemory with the requested capacity.
    • requestClose

      void requestClose(WritableMemory wmemToClose)
      Request to close the given WritableMemory. If applicable, it will be closed by its associated Arena. Be careful. Closing the associated Arena may be closing other resources as well.
      Parameters:
      wmemToClose - the given WritableMemory to close.