Method AllocatePayloadBuffer
AllocatePayloadBuffer(uint)
Allocates a new Payload buffer from the default Payload container.
Declaration
public PayloadHandle AllocatePayloadBuffer(uint payloadSize)
Parameters
Type | Name | Description |
---|---|---|
uint | payloadSize | Number of bytes to allocate; must fall within the range of Minimum |
Returns
Type | Description |
---|---|
Payload |
A valid Payload |
AllocatePayloadBuffer(uint, out NativeArray<byte>)
Allocates a new Payload buffer from the default Payload container.
Declaration
public PayloadHandle AllocatePayloadBuffer(uint payloadSize, out NativeArray<byte> buffer)
Parameters
Type | Name | Description |
---|---|---|
uint | payloadSize | Number of bytes to allocate; must fall within the range of Minimum |
Native |
buffer | NativeArray that allows safe access to the allocated Payload buffer |
Returns
Type | Description |
---|---|
Payload |
A valid Payload |
Remarks
If successful a PayloadHandle referencing the allocated memory is returned, and a NativeArray with read/write access (as a view into the buffer) is passed out. If allocation fails an invalid handle and buffer are returned.
The PayloadHandle must be saved, as it's needed to retrieve the payload buffer again and also to release it. However, the passed out NativeArray is only intended for immediate reading/writing into the buffer; the variable must not be saved.
IMPORTANT: The Payload buffer must eventually be released by calling Release
NOTE: Do not call Dispose on the returned NativeArray; it's only a view into the Payload buffer.