How often are you freeing things? Can you free everything at once?
-
-
-
'cause if so malloc is just ptr++
-
I cannot. But I'm allocating space for managed pointers that need to interop with unmanaged code.
-
Basically I need space to stick pointers but I also need to be able to reuse the space later. I can use a bit for tagging if necessary.
-
You don’t need the bit for tagging because you always have a linked list of free spots.
-
Yeah I got it.
-
Thanks for that :)
End of conversation
New conversation -
-
-
As long a 1 >= width of a ptr: Single linked list where each free slot contains next ptr. add/remove from start of chain to free/alloc.
-
Yeah I was thinking something like that. Doubly linked list and rewire prev/next free when freeing?
-
Do you need double? You’re only just adding/removing to end of chain when you free/alloc.
-
But you can free any value in the list right?
-
Ah no. You point the end to the new thing! Of course!
End of conversation
New conversation -
-
-
/cc
@mbebenita who I believe has played with allocator algorithms -
My rough intuition is something with a forwarding pointer? Freeing links a slot in the free list, but it's all inline?
End of conversation
New conversation -
-
-
How about slab-like allocator with lock-free stack per slab (say 4096 bytes) and free list of such slabs?
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.