[Issue 24006] New: Document locking behavior of the default GC

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 21 10:00:16 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=24006

          Issue ID: 24006
           Summary: Document locking behavior of the default GC
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dlang.org
          Assignee: nobody at puremagic.com
          Reporter: andrej.mitrovich at gmail.com

As Steven mentions here:
https://forum.dlang.org/post/u6tgl4$1v07$1@digitalmars.com

> The D GC has a single global lock to allocate memory -- even memory that might be on a free list. So the threads are all bottlenecked on waiting their turn for the lock.

This behavior isn't documented on https://dlang.org/spec/garbage.html

But it is mentioned in passing on this page:
https://dlang.org/articles/d-array-article.html#caching

Specifically "Doing this means an O(lg(n)) lookup in the GC's memory pool for
every append (not to mention acquiring the global GC lock)."

--


More information about the Digitalmars-d-bugs mailing list