Struct UnsafePayloadRingBuffer
Logging system's primary container for allocating Payload buffers.
Implements
Inherited Members
Namespace: Unity.Logging
Assembly: solution.dll
Syntax
[BurstCompile]
public struct UnsafePayloadRingBuffer : IDisposable
Remarks
This container provides the backing memory for message buffers referenced by LogMessage. It allows fast, thread-safe allocations from a pre-allocated array of native memory, which can be safely accessed by a PayloadHandle value.
This container is utilized internally by LogMemoryManager, and in general it's unnecessary to directly call into it. However, it may be used directly in advanced memory scenarios.
Constructors
| Name | Description |
|---|---|
| UnsafePayloadRingBuffer(uint, byte, Allocator) | Initializes a new instance of the container. |
Fields
| Name | Description |
|---|---|
| AlignTo | Power of 2 align value used in RoundToNextAlign(uint) |
| BufferId | Unique ID value assigned by the user which identifies PayloadHandle as referencing allocations from this instance. |
| MaximumCapacity | Maximum capacity of the container. |
| MaximumPayloadSize | Maximum size for a single Payload block (excludes header) that can be allocated. |
| MinimumCapacity | Minimum capacity of the container. |
| MinimumPayloadSize | Minimum size for a single Payload block (excludes header) that can be allocated. |
Properties
| Name | Description |
|---|---|
| BytesAllocated | Total number of bytes currently allocated from the RingBuffer, including payload headers. |
| BytesAllocatedMax | Max value of BytesAllocated that was registered. |
| Capacity | Capacity of the RingBuffer, which cannot change after RingBuffer has been initialized |
| IsCreated | Returns true if RingBuffer is initialized and not Disposed. |
| MaximumDisjointedPayloadCount | Returns the maximum number of Payloads that can be referenced within a single DisjointedBuffer. |
Methods
| Name | Description |
|---|---|
| AllocatePayload(uint, out PayloadHandle, out NativeArray<byte>, bool) | Allocate a block of memory from the container. |
| DebugDetailsOfPayloadHandle(PayloadHandle) | Debug function that returns details about a particular PayloadHandle. |
| Dispose() | Frees the container's memory and returns this instance to an uninitialized state. |
| IsPayloadHandleValid(PayloadHandle) | Checks if the specified handle currently references a valid memory block. |
| ReclaimReleasedPayloadBlocks() | Reclaims any and all freed memory blocks from the "tail" of the RingBuffer. |
| ReleasePayload(PayloadHandle) | Releases the memory block referenced by the specified handle. |
| RetrievePayloadFromHandle(PayloadHandle, bool, out NativeArray<byte>) | Retrieves a NativeArray for the allocated memory block referenced by the specified handle. |
| RetrievePayloadFromHandle(PayloadHandle, out NativeArray<byte>) | Retrieves a NativeArray for the allocated memory block referenced by the specified handle. |
| RoundToNextAlign(uint) | Changes the input size to the size that is aligned to AlignTo bytes |