Buffer.allocate
Description:
[ CCode ( has_construct_function = false ) ]
public Buffer.allocate (Allocator? allocator, size_t size, AllocationParams? @params)
public Buffer.allocate (Allocator? allocator, size_t size, AllocationParams? @params)
Tries to create a newly allocated buffer with data of the given size and extra parameters from allocator
.
If the requested amount of memory can't be allocated, null
will be returned. The allocated buffer memory is not cleared.
When allocator
is null
, the default memory allocator will be used.
Note that when size
== 0, the buffer will not have memory associated with it.
Parameters:
allocator |
the Allocator to use, or |
size |
the size in bytes of the new buffer's data. |
params |
optional parameters |
Returns:
a new Buffer |