Skip to main content

Timeline for Custom Memory Allocator in C

Current License: CC BY-SA 3.0

3 events
when toggle format what by license comment
Nov 24, 2014 at 21:11 vote accept CommunityBot
Nov 24, 2014 at 4:08 comment added JS1 I second the idea of just using pools instead of rewriting malloc. Just allocate a huge chunk of memory and split it into N nodes. Treat the nodes as a linked list and put them all on a "free list". When you want to allocate a new node, take the head of the free list in constant time. When you want to free a node, add it to the head of the free list, also in constant time. The only slow part is when you run out and need to allocate another huge chunk to split into free nodes.
Nov 23, 2014 at 13:03 history answered Goswin von Brederlow CC BY-SA 3.0