Interface MemorySegmentPool
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
FixedSizeNativeMemorySegmentPool, NativeMemorySegmentPool
Common interface for native memory segment pooling strategies.
- Since:
- 1.2
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptionacquire(long sizeBytes) Acquires a memory segment from the pool.voidclose()intGets the number of segments currently in the pool.voidrelease(MemorySegment segment) Returns a memory segment to the pool for reuse.
-
Method Details
-
acquire
Acquires a memory segment from the pool.- Parameters:
sizeBytes- requested size in bytes- Returns:
- a memory segment of at least the requested size
-
release
Returns a memory segment to the pool for reuse.- Parameters:
segment- the segment to return
-
getPoolSize
int getPoolSize()Gets the number of segments currently in the pool.- Returns:
- pool size
-
close
void close()- Specified by:
closein interfaceAutoCloseable
-