hygoni / precise-leak-sanitizer

A dynamic memory leak detector that can pinpoint where memory is lost, using LLVM pass
Apache License 2.0
18 stars 2 forks source link

Optimize PointerIsMine() for the secondary allocator #75

Closed hygoni closed 1 month ago

hygoni commented 8 months ago

As the commit 30a6aaf66c5bd3c35d63fe37a37131cbd3e7c05b in PR #72, the secondary allocator can be optimized in the same way. However, unlike the primary allocator, there is no way to limit address space for the secondary allocator.

The optimization would be to make the secondary allocator to take address space range just like the primary one.

hygoni commented 8 months ago

Just realzing that this approach is not as easy as because mmap() system calls does not support mmap()ing within specific address range :(

Another approach might be to implement own address space allocator and use MAP_FIXED,

...Or just use a map (hashmap, treemap, bitmap, etc.) that translates an address to boolean type 'allocated from the secondary or not'

hygoni commented 8 months ago

Another approach might be to implement own address space allocator and use MAP_FIXED,

.....and probably (maybe too far?) introduce RCU based balanced tree for better performance.

This is not a small optimization...

hygoni commented 1 month ago

Resolved by METAlloc metadata management scheme