Expand description
Various malloc implementations (conditionally compiled by features) This module exposes a set of malloc API. They are currently implemented with the library malloc. This may change in the future, and will be replaced with a native MMTk implementation. We have two versions for each function:
- a normal version: it has the signature that is compatible with the standard malloc library.
- a counted version: the allocated/freed bytes are calculated into MMTk’s heap. So extra arguments
are needed to maintain allocated bytes properly. The API is inspired by Julia’s counted malloc.
The counted version is only available with the feature
malloc_counted_size.
Modules§
- library 🔒
- Malloc provided by libraries
- malloc_
ms_ 🔒util - Using malloc as mark sweep free-list allocator.
Functions§
- calloc
- Manually allocate memory and initialize the bytes in the allocated memory to zero. Similar to libc’s calloc.
- counted_
calloc - Manually allocate memory and initialize the bytes in the allocated memory to zero. Similar to libc’s calloc. This also counts the allocated memory into the heap size of the given MMTk instance.
- counted_
malloc - Manually allocate memory. Similar to libc’s malloc. This also counts the allocated memory into the heap size of the given MMTk instance.
- free
- Manually free the memory that is returned from other manual allocation functions in this module.
- free_
with_ size - Manually free the memory that is returned from other manual allocation functions in this module. This also reduces the allocated memory size.
- malloc
- Manually allocate memory. Similar to libc’s malloc.
- realloc
- Reallocate the given area of memory. Similar to libc’s realloc.
- realloc_
with_ old_ size - Reallocate the given area of memory. Similar to libc’s realloc. This also adjusts the allocated memory size based on the original allocation and the new allocation, and counts that into the heap size for the given MMTk instance.