TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Tip of the day #2: A safer arena allocator

23 pointsby broken_broken_7 months ago

2 comments

GuB-427 months ago
It is wrong to just use malloc() to make the arena? This way, sanitizers will still help you a bit. It will not help with everything you do within the arena, but it may detect it if you access outside the arena, like the problem the author has.<p>Other than that, I think using guard pages is the technique libefence (electric fence) uses.
mananaysiempre7 months ago
If you want to go further, ASAN and Valgrind both have APIs for integrating custom allocators. So you basically do what ASAN does with malloc in the first place—allocate (a bit more) memory, poison it, then pad all user allocations on both ends and only unpoison the actually requested part.