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.
If size
is 0, the method is allowed but not required to return the null pointer. This
method never returns a the null pointer, but instead throws a 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.
If size
is 0, the method is allowed but not required to return the null pointer. This
method never returns a the null pointer, but instead throws a 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.
If size
is 0, the method is allowed but not required to return the null pointer. This
method never returns a the null pointer, but instead throws a 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.
If size
is 0, the method is allowed but not required to return the null pointer. This
method never returns a the null pointer, but instead throws a 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.
If size
is 0, the method is allowed but not required to return the null pointer. This
method never returns a the null pointer, but instead throws a OutOfMemoryError
when
allocation fails.
public static void free(PointerBase ptr)