Delegate GLFWallocatefun
The function pointer type for memory allocation callbacks.
This is the function pointer type for memory allocation callbacks. A memory allocation callback function has the following signature:
void* function_name(size_t size, void* user)
This function must return either a memory block at least size
bytes long,
or NULL
if allocation failed.Note that not all parts of GLFW handle allocation
failures gracefully yet.
This function must support being called during @ref glfwInit but before the library is flagged as initialized, as well as during @ref glfwTerminate after the library is no longer flagged as initialized.
Any memory allocated via this function will be deallocated via the same allocator during library termination or earlier.
Any memory allocated via this function must be suitably aligned for any object type.
If you are using C99 or earlier, this alignment is platform-dependent but will be the
same as what malloc
provides.If you are using C11 or later, this is the value of
alignof(max_align_t)
.
The size will always be greater than zero. Allocations of size zero are filtered out before reaching the custom allocator.
If this function returns NULL
, GLFW will emit OutOfMemory.
This function must not call any GLFW function.
Added in version 3.4.
Namespace: OpenTK.Windowing.GraphicsLibraryFramework
Assembly: OpenTK.Windowing.GraphicsLibraryFramework.dll
Syntax
public delegate void* GLFWallocatefun(UIntPtr size, void* user)
Parameters
Type | Name | Description |
---|---|---|
UIntPtr | size | The minimum size, in bytes, of the memory block. |
void* | user | The user-defined pointer from the allocator. |
Returns
Type | Description |
---|---|
void* | The address of the newly allocated memory block, or |
Remarks
The returned memory block must be valid at least until it is deallocated.
This function should not call any GLFW function.
This function must support being called from any thread that calls GLFW functions.