Thread overview
[Issue 3523] [GC] Fiber is not garbage collected properly
May 15, 2020
Witold Baryluk
June 09, 2015
https://issues.dlang.org/show_bug.cgi?id=3523

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.032                       |D2

--
October 14, 2016
https://issues.dlang.org/show_bug.cgi?id=3523

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |bootcamp
                 CC|                            |andrei@erdani.com

--
April 24, 2018
https://issues.dlang.org/show_bug.cgi?id=3523

Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy@yahoo.com

--- Comment #15 from Steven Schveighoffer <schveiguy@yahoo.com> ---
This is pretty old, but I wonder if it's still broken?

>From this recent thread, it may already be fixed, as peppering in GC
collections seems to solve the problem:

https://forum.dlang.org/post/vfqvmyossdcqadgassbr@forum.dlang.org

I was coming to file a bug on this, but this seems (at least) to be close to explaining what is happening.

Note that we have a separate issue with Fibers and GC. The GC only associates a small block with the Fiber -- the Fiber object itself, whereas the stack is huge comparatively. In 32-bit windows, a fiber stack is default 32k. This means that 10,000 Fibers probably takes up 1.2MB in the GC (assuming 128 bytes per fiber), but the stack space is 320MB. There is a lack of correlation here between memory pressure and when the memory should be cleaned up.

Would it be possible to deallocate the stack when the Fiber terminates vs. when it's GC'd? That would at least help with Fibers that are completed and just left for garbage.

--
May 15, 2020
https://issues.dlang.org/show_bug.cgi?id=3523

--- Comment #16 from Witold Baryluk <witold.baryluk+d@gmail.com> ---
Steven, yes this is still an issue with current compiler and runtime.

The issue is that yes, it probably is possible to exclude references from one fiber to itself, but there might be weird cases where there are complex chains of fibers pointing to each other, and whole chains isn't accessible from anywhere else, or even from each fiber directly, but it is hard to tell if it is a garbage or not. But if all elements in the chain are in TERM state, or only leaves in the graph are in TERM state, that should be doable. But i have no idea if GC can compute such condition efficiently.

--
December 07
https://issues.dlang.org/show_bug.cgi?id=3523

--- Comment #17 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/17191

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--