Top Description Inners Constructors Methods
org.lwjgl.glfw

public abstract Class GLFWAllocateCallback

extends Callback
implements GLFWAllocateCallbackI
Class Inheritance
All Implemented Interfaces
org.lwjgl.glfw.GLFWAllocateCallbackI, org.lwjgl.system.CallbackI, org.lwjgl.system.Pointer
Known Direct Subclasses
org.lwjgl.glfw.GLFWAllocateCallback.Container
Imports
javax.annotation.*, org.lwjgl.system.*

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 may be called during Init but before the library is flagged as initialized, as well as during Terminate after the library is no longer flagged as initialized.

Any memory allocated by this function will be deallocated during library termination or earlier.

The size will always be greater than zero. Allocations of size zero are filtered out before reaching the custom allocator.

Note

Type


void * (*invoke) (
    size_t size,
    void *user
)
Since
version 3.4

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
protected
pack-priv
GLFWAllocateCallback(long functionPointer)

Method Summary

Modifier and TypeMethod and Description
public static GLFWAllocateCallback

Returns:

the new GLFWAllocateCallback
create
(long functionPointer)

Creates a GLFWAllocateCallback instance from the specified function pointer.

public static GLFWAllocateCallback
create(GLFWAllocateCallbackI instance)

Creates a GLFWAllocateCallback instance that delegates to the specified GLFWAllocateCallbackI instance.

public static GLFWAllocateCallback
createSafe(long functionPointer)

Like create, but returns null if functionPointer is NULL.

Inherited from org.lwjgl.system.Callback:
addressequalsfreefreegetgetSafehashCodetoString

Constructor Detail

GLFWAllocateCallbackback to summary
protected GLFWAllocateCallback()
GLFWAllocateCallbackback to summary
pack-priv GLFWAllocateCallback(long functionPointer)

Method Detail

createback to summary
public static GLFWAllocateCallback create(long functionPointer)

Creates a GLFWAllocateCallback instance from the specified function pointer.

Returns:GLFWAllocateCallback

the new GLFWAllocateCallback

createback to summary
public static GLFWAllocateCallback create(GLFWAllocateCallbackI instance)

Creates a GLFWAllocateCallback instance that delegates to the specified GLFWAllocateCallbackI instance.

createSafeback to summary
public static GLFWAllocateCallback createSafe(long functionPointer)

Like create, but returns null if functionPointer is NULL.

Annotations
@Nullable
org.lwjgl.glfw back to summary

private final Class GLFWAllocateCallback.Container

extends GLFWAllocateCallback
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final GLFWAllocateCallbackI

Constructor Summary

AccessConstructor and Description
pack-priv
Container(long functionPointer, GLFWAllocateCallbackI delegate)

Method Summary

Modifier and TypeMethod and Description
public long
invoke(long
the minimum size, in bytes, of the memory block
size
,
long
the user-defined pointer from the allocator
user
)

Implements org.lwjgl.glfw.GLFWAllocateCallbackI.invoke.

Will be called for memory allocation requests.
Inherited from org.lwjgl.glfw.GLFWAllocateCallback:
createcreatecreateSafe

Field Detail

delegateback to summary
private final GLFWAllocateCallbackI delegate

Constructor Detail

Containerback to summary
pack-priv Container(long functionPointer, GLFWAllocateCallbackI delegate)

Method Detail

invokeback to summary
public long invoke(long size, long user)

Implements org.lwjgl.glfw.GLFWAllocateCallbackI.invoke.

Doc from org.lwjgl.glfw.GLFWAllocateCallbackI.invoke.

Will be called for memory allocation requests.

Parameters
size:long

the minimum size, in bytes, of the memory block

user:long

the user-defined pointer from the allocator

Returns:long

the address of the newly allocated memory block, or NULL if an error occurred

Annotations
@Override