Poor memory allocation performance with a lot of threads on 36 core machine

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 18 05:10:28 PST 2016


On 02/18/2016 02:00 PM, Witek wrote:
> So, the question is, why is D / DMD allocator so slow under heavy
> multithreading? The working set is pretty small (few megabytes at most),
> so I do not think this is an issue with GC scanning itself.  Can I
> plug-in tcmalloc / jemalloc, to be used as the underlying allocator,
> instead of using glibc? Or is D runtime using mmap/srbk/etc directly?

DMD/druntime use stop-the-world GC implementation. That means every time
anything needs to be allocated there is possibility of collection cycle
which will pause execution of all threads. It doesn't matter if there is
much garbage - the very pause is the problem.

Using allocations not controlled by GC (even plain malloc) should change
situation notably.


More information about the Digitalmars-d mailing list