3 ms·
That sounds like a lot of work unless you absolutely have to have a contiguous allocation of every element. If you don't need that, you can get "O(1.1)" access
by kabdib 4y ago
That sounds like a lot of work unless you absolutely have to have a contiguous allocation of every element.
If you don't need that, you can get "O(1.1)" access and nice heap behavior with an indirection or two, and the implementation is likely to be lots more portable and standards-friendly than if you also dragged in a bunch of OS mmap() semantics (which tend to have exciting, platform-dependent misfeatures).
Also, I would have to reach for the mmap() man page. I have malloc() right in front of me. :-)