|
|
Log in / Subscribe / Register

C++ already gives us a tool for pointer zapping

C++ already gives us a tool for pointer zapping

Posted Oct 17, 2024 18:35 UTC (Thu) by notriddle (subscriber, #130608)
In reply to: C++ already gives us a tool for pointer zapping by epa
Parent article: Zapping pointers out of thin air

> In a 64-bit address space, how hard would it be to guarantee that malloc() returns a unique value each time?

Isn't the real problem nowadays TLB and cache utilization? Because it seems like this would result in severe fragmentation.


to post comments

C++ already gives us a tool for pointer zapping

Posted Oct 18, 2024 18:05 UTC (Fri) by Wol (subscriber, #4433) [Link]

It would be a bit more work for the programmer, but this sounds like it would be easily possible with arena allocs.

I understand behind the scenes malloc allocates a big area, which it hands out in small bits. If that big area is an entry in the page table, and especially if the programmer can hint to malloc that "these are long lived, these are short lived, these are small, these are large", it's then easy to move/consolidate all this in ram (copy, update the page table, you're done), and malloc can just drop the arena and not re-use the arena's logical address when it's all freed.

Cheers,
Wol


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds