3 ms·
In support of flohofwoe's point: good implementations of malloc will, on the common path, just bump a pointer without synchronization. The allocation path of go
by scott_s 7y ago
In support of flohofwoe's point: good implementations of malloc will, on the common path, just bump a pointer without synchronization. The allocation path of good manual allocator implementations and garbage collectors will probably look similar.
- chrisseaton 7y ago> In support of flohofwoe's point: good implementations of malloc will, on the common path, just bump a pointer without synchronization. How does this work when the heap address space becomes fragmented, with randomly distributed available space and objects that are still live? You can't just bump when the next piece of memory may still be in use, and when you're not able to move memory.
- lonelappde 7y agoThat's the uncommon path.
- scott_s 7y agoYes, exactly. And! It exists in garbage collectors, too.
- chrisseaton 7y agoWhy would you ever encounter a fragmented Eden in a garbage collector?
- scott_s 7y agoI wasn't thinking of that case in particular, but that there are other instance in a garbage collector where you will not just be able to bump a pointer: you need to request more memory from the OS, or you need to start a collection phase before satisfying a memory request.