mmtk-core
mmtk-core copied to clipboard
starting_heap_address() and last_heap_address() returns wrong values for certain cases
The two functions still return our constants for heap start/end. But for a few cases, they do not return correct values.
- malloc marksweep may return addresses outside the range.
- for 64 bits, we use addresses beyond
HEAP_END
- if we allocate with
disable_collection()
(https://github.com/mmtk/mmtk-core/pull/474), we allow allocation beyond our heap limit. The addresses may go beyond the heap range.
We may keep variables in SFTMap
about the start/end chunk, and update this when we set SFT entries. This can tell us where the heap range is.
With VMLayout
introduced in https://github.com/mmtk/mmtk-core/commit/039055ab9a94ac48919a8f3fac090248e406373d, the heap start and the heap end are no longer compile-time constants, but can be configured by the VM binding. Since then, memory_manager::{starting,last}_heap_address()
return VMLayout::heap_{start,end}
, respectively. This covers 64-bit address spaces as well.
last_heap_address
is the upper bound of address which mmtk-core is willing to mmap, so it is impossible to allocate any memory beyond that, even if disable_collection()
is called.
Malloc is beyond the control of mmtk-core. It is implemented by third-party libraries, and mmtk-core cannot control where they allocate memory.