java.lang.Object
org.elasticsearch.simdvec.internal.AddressesScratch
Reusable, lazily-grown scratch buffer for an array of native addresses
(pointer-width values), used to hand a contiguous
MemorySegment
of MemorySegment#address()-style values (array of pointers).
Not thread-safe; instances must not be shared across threads.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget(int count) Returns aMemorySegmentof at leastcountnative-address slots.
-
Constructor Details
-
AddressesScratch
public AddressesScratch()
-
-
Method Details
-
get
Returns aMemorySegmentof at leastcountnative-address slots. The buffer may be larger than requested (it is grown lazily and never shrunk across calls); callers must respect their owncountwhen reading or writing addresses. Always returns the same backing segment for a given instance until a larger one is needed.Segments are returned from an auto arena, so they are garbage-collected. Choice here was between:
- a confined arena (but confined arenas have thread affinity, which is probably OK for our use cases, but it would add a very implicit contract),
- a shared arena (but that has extra invocation costs)
- or an auto arena.
-