Re:Drop millions of allocations by using a linked list (2015)
by sgtnoodle on Friday March 12, 2021 @12:24PM
(#26438219)
I usually end up with a singly linked list when implementing a singleton API that needs to support an arbitrary number of application created objects. Rather than have the singleton pre-allocate the memory, the application has to do it, then pass it into the API to use for the lifetime of the program. The various parts of the application knows how many objects it needs, and can statically allocate just the right amount of memory.
[ Parent
| on HN ]
There are no comments on this comment yet.