5 ms·
Is there an allocator that uses lockless programming?
by senatorobama 9y ago
Is there an allocator that uses lockless programming?
- bonzini 9y agoYou can do mostly lockless. The fast path is what matters the most, the difficult part is not wasting too much memory for the sake of not hitting the slow path.
- masklinn 9y agoIIRC jemalloc has per-thread pools & caches which I assume can be accessed locklessly. I don't think the entire thing is lossless, and neither is tcmalloc. And as far as I know these are the only significantly thread-aware allocators (or at least production-ready ones).
- bonzini 9y agoglibc has also grown a good thread-aware allocator, though that is more recent than tcmalloc or jemalloc.
- qznc 9y agoYou may find this interesting: https://concurrencyfreaks.blogspot.de/2017/08/why-is-memory-reclamation-so-important.html https://concurrencyfreaks.blogspot.de/2017/08/why-is-memory-...
- valarauca1 9y agoLow contention lock-less structures are slower then low contention locks. You end up doing more work and get less in return. JEmalloc does locking on multiple pools, failing one it tries another. So there is a high probability it won't preform many atomic CAS ops.