Top Description Constructors Methods
org.lwjgl.system.libc

public Class LibCStdlib

extends Object
Class Inheritance
Imports
javax.annotation.*, java.nio.*, org.lwjgl.*, org.lwjgl.system.*

Native bindings to stdlib.h.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static ByteBuffer
aligned_alloc(long
the alignment. Must be a power of two value.
alignment
,
long
the number of bytes to allocate. Must be a multiple of alignment.
size
)

Allocates size bytes of uninitialized storage whose alignment is specified by alignment.

public static void
aligned_free(ByteBuffer
the aligned block of memory to free
ptr
)

Frees a block of memory that was allocated with aligned_alloc.

public static void
aligned_free(ShortBuffer
the aligned block of memory to free
ptr
)

Frees a block of memory that was allocated with aligned_alloc.

public static void
aligned_free(IntBuffer
the aligned block of memory to free
ptr
)

Frees a block of memory that was allocated with aligned_alloc.

public static void
aligned_free(LongBuffer
the aligned block of memory to free
ptr
)

Frees a block of memory that was allocated with aligned_alloc.

public static void
aligned_free(FloatBuffer
the aligned block of memory to free
ptr
)

Frees a block of memory that was allocated with aligned_alloc.

public static void
aligned_free(DoubleBuffer
the aligned block of memory to free
ptr
)

Frees a block of memory that was allocated with aligned_alloc.

public static void
aligned_free(PointerBuffer
the aligned block of memory to free
ptr
)

Frees a block of memory that was allocated with aligned_alloc.

public static ByteBuffer
calloc(long
the number of elements to allocate
nmemb
,
long
the number of bytes to allocate per element
size
)

Allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory.

public static void
free(ByteBuffer
the memory space to free
ptr
)

Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc, calloc, or realloc.

public static void
free(ShortBuffer
the memory space to free
ptr
)

Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc, calloc, or realloc.

public static void
free(IntBuffer
the memory space to free
ptr
)

Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc, calloc, or realloc.

public static void
free(LongBuffer
the memory space to free
ptr
)

Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc, calloc, or realloc.

public static void
free(FloatBuffer
the memory space to free
ptr
)

Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc, calloc, or realloc.

public static void
free(DoubleBuffer
the memory space to free
ptr
)

Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc, calloc, or realloc.

public static void
free(PointerBuffer
the memory space to free
ptr
)

Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc, calloc, or realloc.

public static ByteBuffer
malloc(long
the number of bytes to allocate
size
)

Allocates size bytes and returns a pointer to the allocated memory.

public static native long
naligned_alloc(long alignment, long size)

Unsafe version of: aligned_alloc

public static native void
naligned_free(long ptr)

Unsafe version of: aligned_free

public static native long
ncalloc(long nmemb, long size)

Unsafe version of: calloc

public static native void
nfree(long ptr)

Unsafe version of: free

public static native long
nmalloc(long size)

Unsafe version of: malloc

public static native long
nrealloc(long ptr, long size)

Unsafe version of: realloc

public static ByteBuffer
realloc(ByteBuffer
the memory block to reallocate
ptr
,
long
the new memory block size, in bytes
size
)

Changes the size of the memory block pointed to by ptr to size bytes The contents will be unchanged in the range from the start of the region up to the minimum of the old and new sizes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

LibCStdlibback to summary
protected LibCStdlib()

Method Detail

aligned_allocback to summary
public static ByteBuffer aligned_alloc(long alignment, long size)

Allocates size bytes of uninitialized storage whose alignment is specified by alignment. The size parameter must be an integral multiple of alignment. Memory allocated with aligned_alloc() must be freed with aligned_free.

Parameters
alignment:long

the alignment. Must be a power of two value.

size:long

the number of bytes to allocate. Must be a multiple of alignment.

Annotations
@Nullable
@NativeType:void *
aligned_freeback to summary
public static void aligned_free(ByteBuffer ptr)

Frees a block of memory that was allocated with aligned_alloc. If ptr is NULL, no operation is performed.

Parameters
ptr:ByteBuffer

the aligned block of memory to free

aligned_freeback to summary
public static void aligned_free(ShortBuffer ptr)

Frees a block of memory that was allocated with aligned_alloc. If ptr is NULL, no operation is performed.

Parameters
ptr:ShortBuffer

the aligned block of memory to free

aligned_freeback to summary
public static void aligned_free(IntBuffer ptr)

Frees a block of memory that was allocated with aligned_alloc. If ptr is NULL, no operation is performed.

Parameters
ptr:IntBuffer

the aligned block of memory to free

aligned_freeback to summary
public static void aligned_free(LongBuffer ptr)

Frees a block of memory that was allocated with aligned_alloc. If ptr is NULL, no operation is performed.

Parameters
ptr:LongBuffer

the aligned block of memory to free

aligned_freeback to summary
public static void aligned_free(FloatBuffer ptr)

Frees a block of memory that was allocated with aligned_alloc. If ptr is NULL, no operation is performed.

Parameters
ptr:FloatBuffer

the aligned block of memory to free

aligned_freeback to summary
public static void aligned_free(DoubleBuffer ptr)

Frees a block of memory that was allocated with aligned_alloc. If ptr is NULL, no operation is performed.

Parameters
ptr:DoubleBuffer

the aligned block of memory to free

aligned_freeback to summary
public static void aligned_free(PointerBuffer ptr)

Frees a block of memory that was allocated with aligned_alloc. If ptr is NULL, no operation is performed.

Parameters
ptr:PointerBuffer

the aligned block of memory to free

callocback to summary
public static ByteBuffer calloc(long nmemb, long size)

Allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. The memory is set to zero. If nmemb or size is 0, then calloc() returns either NULL, or a unique pointer value that can later be successfully passed to free.

Parameters
nmemb:long

the number of elements to allocate

size:long

the number of bytes to allocate per element

Annotations
@Nullable
@NativeType:void *
freeback to summary
public static void free(ByteBuffer ptr)

Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc, calloc, or realloc. Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is NULL, no operation is performed.

Parameters
ptr:ByteBuffer

the memory space to free

freeback to summary
public static void free(ShortBuffer ptr)

Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc, calloc, or realloc. Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is NULL, no operation is performed.

Parameters
ptr:ShortBuffer

the memory space to free

freeback to summary
public static void free(IntBuffer ptr)

Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc, calloc, or realloc. Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is NULL, no operation is performed.

Parameters
ptr:IntBuffer

the memory space to free

freeback to summary
public static void free(LongBuffer ptr)

Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc, calloc, or realloc. Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is NULL, no operation is performed.

Parameters
ptr:LongBuffer

the memory space to free

freeback to summary
public static void free(FloatBuffer ptr)

Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc, calloc, or realloc. Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is NULL, no operation is performed.

Parameters
ptr:FloatBuffer

the memory space to free

freeback to summary
public static void free(DoubleBuffer ptr)

Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc, calloc, or realloc. Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is NULL, no operation is performed.

Parameters
ptr:DoubleBuffer

the memory space to free

freeback to summary
public static void free(PointerBuffer ptr)

Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc, calloc, or realloc. Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is NULL, no operation is performed.

Parameters
ptr:PointerBuffer

the memory space to free

mallocback to summary
public static ByteBuffer malloc(long size)

Allocates size bytes and returns a pointer to the allocated memory. The memory is not initialized. If size is 0, then malloc() returns either NULL, or a unique pointer value that can later be successfully passed to free.

Parameters
size:long

the number of bytes to allocate

Annotations
@Nullable
@NativeType:void *
naligned_allocback to summary
public static native long naligned_alloc(long alignment, long size)

Unsafe version of: aligned_alloc

naligned_freeback to summary
public static native void naligned_free(long ptr)

Unsafe version of: aligned_free

ncallocback to summary
public static native long ncalloc(long nmemb, long size)

Unsafe version of: calloc

nfreeback to summary
public static native void nfree(long ptr)

Unsafe version of: free

nmallocback to summary
public static native long nmalloc(long size)

Unsafe version of: malloc

nreallocback to summary
public static native long nrealloc(long ptr, long size)

Unsafe version of: realloc

reallocback to summary
public static ByteBuffer realloc(ByteBuffer ptr, long size)

Changes the size of the memory block pointed to by ptr to size bytes The contents will be unchanged in the range from the start of the region up to the minimum of the old and new sizes. If the new size is larger than the old size, the added memory will not be initialized. If ptr is NULL, then the call is equivalent to malloc(size), for all values of size; if size is equal to zero, and ptr is not NULL, then the call is equivalent to free(ptr). Unless ptr is NULL, it must have been returned by an earlier call to malloc, calloc or realloc. If the area pointed to was moved, a free(ptr) is done.

Parameters
ptr:ByteBuffer

the memory block to reallocate

size:long

the new memory block size, in bytes

Annotations
@Nullable
@NativeType:void *