Remix.run Logo
carlos256 5 hours ago

If you need to optimize the allocator you are doing it wrong.

cbarrick 5 hours ago | parent [-]

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