Package org.capnproto
Class DefaultAllocator
- java.lang.Object
-
- org.capnproto.DefaultAllocator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultAllocator.ByteBufferAllocationStyle
-
Field Summary
Fields Modifier and Type Field Description BuilderArena.AllocationStrategyallocationStrategyDefaultAllocator.ByteBufferAllocationStyleallocationStyleintmaxSegmentBytesThe largest number of bytes to try allocating when using `GROW_HEURISTICALLY`.
-
Constructor Summary
Constructors Constructor Description DefaultAllocator()DefaultAllocator(BuilderArena.AllocationStrategy allocationStrategy)DefaultAllocator(BuilderArena.AllocationStrategy allocationStrategy, DefaultAllocator.ByteBufferAllocationStyle style)DefaultAllocator(DefaultAllocator.ByteBufferAllocationStyle style)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBufferallocateSegment(int minimumSize)Allocates a ByteBuffer to be used as a segment in a message.voidsetNextAllocationSizeBytes(int nextSize)
-
-
-
Field Detail
-
allocationStyle
public DefaultAllocator.ByteBufferAllocationStyle allocationStyle
-
allocationStrategy
public BuilderArena.AllocationStrategy allocationStrategy
-
maxSegmentBytes
public int maxSegmentBytes
The largest number of bytes to try allocating when using `GROW_HEURISTICALLY`. Set this value smaller if you get the error: java.lang.OutOfMemoryError: Requested array size exceeds VM limit Experimentally, `Integer.MAX_VALUE - 2` seems to work on most systems.
-
-
Constructor Detail
-
DefaultAllocator
public DefaultAllocator()
-
DefaultAllocator
public DefaultAllocator(BuilderArena.AllocationStrategy allocationStrategy)
-
DefaultAllocator
public DefaultAllocator(DefaultAllocator.ByteBufferAllocationStyle style)
-
DefaultAllocator
public DefaultAllocator(BuilderArena.AllocationStrategy allocationStrategy, DefaultAllocator.ByteBufferAllocationStyle style)
-
-
Method Detail
-
setNextAllocationSizeBytes
public void setNextAllocationSizeBytes(int nextSize)
-
allocateSegment
public ByteBuffer allocateSegment(int minimumSize)
Description copied from interface:AllocatorAllocates a ByteBuffer to be used as a segment in a message. The returned buffer must contain at least `minimumSize` bytes, all of which MUST be set to zero.- Specified by:
allocateSegmentin interfaceAllocator
-
-