Module mmtk::util::malloc

source ·
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
  • Using malloc as mark sweep free-list allocator.

Functions§

  • Manually allocate memory and initialize the bytes in the allocated memory to zero. Similar to libc’s 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.
  • Manually allocate memory. Similar to libc’s malloc. This also counts the allocated memory into the heap size of the given MMTk instance.
  • Manually free the memory that is returned from other manual allocation functions in this module.
  • Manually free the memory that is returned from other manual allocation functions in this module. This also reduces the allocated memory size.
  • Manually allocate memory. Similar to libc’s malloc.
  • Reallocate the given area of memory. Similar to libc’s realloc.
  • 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.