Open playXE opened 4 years ago
Hi @playXE ; fun project :-) Scanning roots should be fast so mimalloc may be a good fit: on 64-bit systems, mimalloc allocates above the 4TiB address space -- that gives you a quick initial test right there. It will also allocate under 30TiB (unless using extreme workloads) so that is another quick check. The mi_heap_check_owned
is slowish and more meant for analysis tools; the mi_heap_contains_block
is faster, but as you noticed in #299, it does not work for large allocations (since those are not owned).
The call you need is mi_is_in_heap_region
which should work for most allocations except very large ones (I believe over 128MiB)
The implementation in the dev-slice
branch of mimalloc
does work for any allocation, and you may base your work of that (the intention is for dev-slice
to be a future version of mimalloc).
Hope this helps!
Thanks for answer @daanx ! This helps a lot :)
I want to do mostly precise GC and for scanning roots I need a way to find heap pointer, do I understand correctly that to identify allocated heap pointer I should use
mi_heap_check_owned
andmi_heap_contains_block
like this?