1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-10-26 20:02:33 +00:00

UserspaceEmulator: Hang malloc metadata on malloc block MmapRegions

Instead of tracking known malloc blocks in a separate hash table,
add an optional malloc metadata pointer to MmapRegion.

This makes finding the malloc metadata for a given pointer extremely
fast since it can piggyback on the page table array. :^)
This commit is contained in:
Andreas Kling 2020-11-16 09:33:30 +01:00
parent 395313039d
commit f41b9946e2
4 changed files with 77 additions and 83 deletions

View file

@ -58,11 +58,6 @@ MmapRegion::MmapRegion(u32 base, u32 size, int prot)
MmapRegion::~MmapRegion()
{
if (is_malloc_block()) {
if (auto* tracer = Emulator::the().malloc_tracer())
tracer->notify_malloc_block_was_released({}, *this);
}
free(m_shadow_data);
if (m_file_backed)
munmap(m_data, size());