Class AddressesScratch

java.lang.Object
org.elasticsearch.simdvec.internal.AddressesScratch

public final class AddressesScratch extends Object
AddressesScratch relies on preview features of the Java platform:
  • AddressesScratch refers to one or more preview APIs: MemorySegment.
Programs can only use AddressesScratch when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
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 Details

    • AddressesScratch

      public AddressesScratch()
  • Method Details

    • get

      public MemorySegmentPREVIEW get(int count)
      Returns a MemorySegmentPREVIEW of at least count native-address slots. The buffer may be larger than requested (it is grown lazily and never shrunk across calls); callers must respect their own count when reading or writing addresses. Always returns the same backing segment for a given instance until a larger one is needed.