0 Followers
0 Following
1 Posts
SRE at Google / Prolog Fanhttps://cbarrick.dev
This account is a replica from Hacker News. Its author can't see your replies. If you find this service useful, please consider supporting us via our Patreon.
Officialhttps://
Support this servicehttps://www.patreon.com/birddotmakeup

Exactly. No need to engineer an allocator. You only live once!

void* malloc(size_t size) {
void *ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
return (ptr == MAP_FAILED) ? NULL : ptr;
}

void free(void *ptr) { /* YOLO */ }


/s