Post AX4FsFkizPRaIxLOt6 by ctrl@possum.city
(DIR) More posts by ctrl@possum.city
(DIR) Post #AX4FsFkizPRaIxLOt6 by ctrl@possum.city
2023-06-26T01:07:06.446Z
0 likes, 0 repeats
i wanted to create a small one header file C library to help me handle memory management.the idea was simple, create one huge allocation, (an arena, zone, whatever), and then use it to do all of our memory manipulation.so you'd get an arena_create(), which create the arenaan arena_alloc(arena* a, size_t n), which 'allocate' memory (basicly increment a pointer with the size of nand an arena_dealloc(arena* a, void* ptr) and that would decrement the pointerand finally an arena_destroy(arena* a) that nukes the thingy(okay yes i know, at this point its a glorified stack, with a few issues)so i thought : okay maybe have a linked list of some kind, that handle the case if memory is deallocated in between allocations. (so for exemple, allocate a, b and c and then remove b)(which i would later learned is called a free-list)A few days after, i was still thinking about it, but i did not worked actively on it. And for some reason this day i was at school. And like a moron, i forgot to push the project i was working on, so i thought 'no biggie, im gonna start an other project'. And one of the project available was to recreate malloc.And now i'm asking myself some question, about if its worth working on the arena concept or not, and also how would it really differs from malloc ? (except that uh, it does not use mmap directly lol)cause from what i saw, malloc has a similar structure, since for small allocations you allocate a huge chunk of memory, and then you manage it with a free-list and all
(DIR) Post #AX4FsGtGl7sBpkLjqS by ctrl@possum.city
2023-06-26T01:09:53.441Z
1 likes, 0 repeats
need to do some C tomorrow, it scratches my brain in such a way uuurgh i love itC makes me feel things no other languages manyages topython makes me want to diejs makes me want to murder and diets makes me want to dierust makes me feel smart, and also makes me want to diejava... javahaskell makes me feel dumb, i need to learn seriously honestlyc++ makes me hate myself, those errors messages gave me ptsd