Package org.lwjgl.system.libc
Class LibCStdlib
java.lang.Object
org.lwjgl.system.libc.LibCStdlib
Native bindings to stdlib.h.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ByteBuffer
aligned_alloc
(long alignment, long size) Allocatessize
bytes of uninitialized storage whose alignment is specified byalignment
.static void
aligned_free
(ByteBuffer ptr) Frees a block of memory that was allocated withaligned_alloc(long, long)
.static void
aligned_free
(DoubleBuffer ptr) Frees a block of memory that was allocated withaligned_alloc(long, long)
.static void
aligned_free
(FloatBuffer ptr) Frees a block of memory that was allocated withaligned_alloc(long, long)
.static void
aligned_free
(IntBuffer ptr) Frees a block of memory that was allocated withaligned_alloc(long, long)
.static void
aligned_free
(LongBuffer ptr) Frees a block of memory that was allocated withaligned_alloc(long, long)
.static void
aligned_free
(ShortBuffer ptr) Frees a block of memory that was allocated withaligned_alloc(long, long)
.static void
aligned_free
(org.lwjgl.PointerBuffer ptr) Frees a block of memory that was allocated withaligned_alloc(long, long)
.static ByteBuffer
calloc
(long nmemb, long size) Allocates memory for an array ofnmemb
elements ofsize
bytes each and returns a pointer to the allocated memory.static void
free
(ByteBuffer ptr) Frees the memory space pointed to byptr
, which must have been returned by a previous call tomalloc(long)
,calloc(long, long)
, orrealloc(java.nio.ByteBuffer, long)
.static void
free
(DoubleBuffer ptr) Frees the memory space pointed to byptr
, which must have been returned by a previous call tomalloc(long)
,calloc(long, long)
, orrealloc(java.nio.ByteBuffer, long)
.static void
free
(FloatBuffer ptr) Frees the memory space pointed to byptr
, which must have been returned by a previous call tomalloc(long)
,calloc(long, long)
, orrealloc(java.nio.ByteBuffer, long)
.static void
Frees the memory space pointed to byptr
, which must have been returned by a previous call tomalloc(long)
,calloc(long, long)
, orrealloc(java.nio.ByteBuffer, long)
.static void
free
(LongBuffer ptr) Frees the memory space pointed to byptr
, which must have been returned by a previous call tomalloc(long)
,calloc(long, long)
, orrealloc(java.nio.ByteBuffer, long)
.static void
free
(ShortBuffer ptr) Frees the memory space pointed to byptr
, which must have been returned by a previous call tomalloc(long)
,calloc(long, long)
, orrealloc(java.nio.ByteBuffer, long)
.static void
free
(org.lwjgl.PointerBuffer ptr) Frees the memory space pointed to byptr
, which must have been returned by a previous call tomalloc(long)
,calloc(long, long)
, orrealloc(java.nio.ByteBuffer, long)
.static ByteBuffer
malloc
(long size) Allocatessize
bytes and returns a pointer to the allocated memory.static long
naligned_alloc
(long alignment, long size) Unsafe version of:aligned_alloc(long, long)
static void
naligned_free
(long ptr) Unsafe version of:aligned_free(java.nio.ByteBuffer)
static long
ncalloc
(long nmemb, long size) Unsafe version of:calloc(long, long)
static void
nfree
(long ptr) Unsafe version of:free(java.nio.ByteBuffer)
static long
nmalloc
(long size) Unsafe version of:malloc(long)
static long
nrealloc
(long ptr, long size) Unsafe version of:realloc(java.nio.ByteBuffer, long)
static ByteBuffer
realloc
(ByteBuffer ptr, long size) Changes the size of the memory block pointed to byptr
tosize
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.
-
Method Details
-
nmalloc
public static long nmalloc(long size) Unsafe version of:malloc(long)
-
malloc
Allocatessize
bytes and returns a pointer to the allocated memory. The memory is not initialized. Ifsize
is 0, then malloc() returns eitherNULL
, or a unique pointer value that can later be successfully passed tofree(java.nio.ByteBuffer)
.- Parameters:
size
- the number of bytes to allocate
-
ncalloc
public static long ncalloc(long nmemb, long size) Unsafe version of:calloc(long, long)
-
calloc
Allocates memory for an array ofnmemb
elements ofsize
bytes each and returns a pointer to the allocated memory. The memory is set to zero. Ifnmemb
orsize
is 0, then calloc() returns eitherNULL
, or a unique pointer value that can later be successfully passed tofree(java.nio.ByteBuffer)
.- Parameters:
nmemb
- the number of elements to allocatesize
- the number of bytes to allocate per element
-
nrealloc
public static long nrealloc(long ptr, long size) Unsafe version of:realloc(java.nio.ByteBuffer, long)
-
realloc
Changes the size of the memory block pointed to byptr
tosize
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. Ifptr
isNULL
, then the call is equivalent tomalloc(size)
, for all values ofsize
; ifsize
is equal to zero, andptr
is notNULL
, then the call is equivalent tofree(ptr)
. Unlessptr
isNULL
, it must have been returned by an earlier call tomalloc(long)
,calloc(long, long)
orrealloc(java.nio.ByteBuffer, long)
. If the area pointed to was moved, afree(ptr)
is done.- Parameters:
ptr
- the memory block to reallocatesize
- the new memory block size, in bytes
-
nfree
public static void nfree(long ptr) Unsafe version of:free(java.nio.ByteBuffer)
-
free
Frees the memory space pointed to byptr
, which must have been returned by a previous call tomalloc(long)
,calloc(long, long)
, orrealloc(java.nio.ByteBuffer, long)
. Otherwise, or iffree(ptr)
has already been called before, undefined behavior occurs. If ptr isNULL
, no operation is performed.- Parameters:
ptr
- the memory space to free
-
free
Frees the memory space pointed to byptr
, which must have been returned by a previous call tomalloc(long)
,calloc(long, long)
, orrealloc(java.nio.ByteBuffer, long)
. Otherwise, or iffree(ptr)
has already been called before, undefined behavior occurs. If ptr isNULL
, no operation is performed.- Parameters:
ptr
- the memory space to free
-
free
Frees the memory space pointed to byptr
, which must have been returned by a previous call tomalloc(long)
,calloc(long, long)
, orrealloc(java.nio.ByteBuffer, long)
. Otherwise, or iffree(ptr)
has already been called before, undefined behavior occurs. If ptr isNULL
, no operation is performed.- Parameters:
ptr
- the memory space to free
-
free
Frees the memory space pointed to byptr
, which must have been returned by a previous call tomalloc(long)
,calloc(long, long)
, orrealloc(java.nio.ByteBuffer, long)
. Otherwise, or iffree(ptr)
has already been called before, undefined behavior occurs. If ptr isNULL
, no operation is performed.- Parameters:
ptr
- the memory space to free
-
free
Frees the memory space pointed to byptr
, which must have been returned by a previous call tomalloc(long)
,calloc(long, long)
, orrealloc(java.nio.ByteBuffer, long)
. Otherwise, or iffree(ptr)
has already been called before, undefined behavior occurs. If ptr isNULL
, no operation is performed.- Parameters:
ptr
- the memory space to free
-
free
Frees the memory space pointed to byptr
, which must have been returned by a previous call tomalloc(long)
,calloc(long, long)
, orrealloc(java.nio.ByteBuffer, long)
. Otherwise, or iffree(ptr)
has already been called before, undefined behavior occurs. If ptr isNULL
, no operation is performed.- Parameters:
ptr
- the memory space to free
-
free
public static void free(@Nullable org.lwjgl.PointerBuffer ptr) Frees the memory space pointed to byptr
, which must have been returned by a previous call tomalloc(long)
,calloc(long, long)
, orrealloc(java.nio.ByteBuffer, long)
. Otherwise, or iffree(ptr)
has already been called before, undefined behavior occurs. If ptr isNULL
, no operation is performed.- Parameters:
ptr
- the memory space to free
-
naligned_alloc
public static long naligned_alloc(long alignment, long size) Unsafe version of:aligned_alloc(long, long)
-
aligned_alloc
Allocatessize
bytes of uninitialized storage whose alignment is specified byalignment
. The size parameter must be an integral multiple of alignment. Memory allocated with aligned_alloc() must be freed withaligned_free(java.nio.ByteBuffer)
.- Parameters:
alignment
- the alignment. Must be a power of two value.size
- the number of bytes to allocate. Must be a multiple ofalignment
.
-
naligned_free
public static void naligned_free(long ptr) Unsafe version of:aligned_free(java.nio.ByteBuffer)
-
aligned_free
Frees a block of memory that was allocated withaligned_alloc(long, long)
. If ptr isNULL
, no operation is performed.- Parameters:
ptr
- the aligned block of memory to free
-
aligned_free
Frees a block of memory that was allocated withaligned_alloc(long, long)
. If ptr isNULL
, no operation is performed.- Parameters:
ptr
- the aligned block of memory to free
-
aligned_free
Frees a block of memory that was allocated withaligned_alloc(long, long)
. If ptr isNULL
, no operation is performed.- Parameters:
ptr
- the aligned block of memory to free
-
aligned_free
Frees a block of memory that was allocated withaligned_alloc(long, long)
. If ptr isNULL
, no operation is performed.- Parameters:
ptr
- the aligned block of memory to free
-
aligned_free
Frees a block of memory that was allocated withaligned_alloc(long, long)
. If ptr isNULL
, no operation is performed.- Parameters:
ptr
- the aligned block of memory to free
-
aligned_free
Frees a block of memory that was allocated withaligned_alloc(long, long)
. If ptr isNULL
, no operation is performed.- Parameters:
ptr
- the aligned block of memory to free
-
aligned_free
public static void aligned_free(@Nullable org.lwjgl.PointerBuffer ptr) Frees a block of memory that was allocated withaligned_alloc(long, long)
. If ptr isNULL
, no operation is performed.- Parameters:
ptr
- the aligned block of memory to free
-