public final class UnmanagedMemory extends Object
Modifier and Type | Method and Description |
---|---|
static <T extends PointerBase> |
calloc(int size)
Allocates
size bytes of unmanaged memory. |
static <T extends PointerBase> |
calloc(UnsignedWord size)
Allocates
size bytes of unmanaged memory. |
static void |
free(PointerBase ptr)
Frees unmanaged memory that was previously allocated using methods of this class.
|
static <T extends PointerBase> |
malloc(int size)
Allocates
size bytes of unmanaged memory. |
static <T extends PointerBase> |
malloc(UnsignedWord size)
Allocates
size bytes of unmanaged memory. |
static <T extends PointerBase> |
realloc(T ptr,
UnsignedWord size)
Changes the size of the provided unmanaged memory to
size bytes of unmanaged memory. |
public static <T extends PointerBase> T malloc(UnsignedWord size)
size
bytes of unmanaged memory. The content of the memory is undefined.
This method never returns a null pointer, but instead throws an OutOfMemoryError
when
allocation fails.
public static <T extends PointerBase> T malloc(int size)
size
bytes of unmanaged memory. The content of the memory is undefined.
This method never returns a null pointer, but instead throws an OutOfMemoryError
when
allocation fails.
public static <T extends PointerBase> T calloc(UnsignedWord size)
size
bytes of unmanaged memory. The content of the memory is set to 0.
This method never returns a null pointer, but instead throws an OutOfMemoryError
when
allocation fails.
public static <T extends PointerBase> T calloc(int size)
size
bytes of unmanaged memory. The content of the memory is set to 0.
This method never returns a null pointer, but instead throws an OutOfMemoryError
when
allocation fails.
public static <T extends PointerBase> T realloc(T ptr, UnsignedWord size)
size
bytes of unmanaged memory.
If the new size is larger than the old size, the content of the additional memory is
undefined.
This method never returns a null pointer, but instead throws an OutOfMemoryError
when
allocation fails. In that case, the old data is not deallocated and remains unchanged.
public static void free(PointerBase ptr)
null
.