Comment by cbarrick
13 hours ago
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
No comments yet
Contribute on Hacker News ↗