[Issue 23611] Zombie heap leak proof of concept: linked list in dead resized array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 9 19:18:20 UTC 2023


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

Iain Buclaw <ibuclaw at gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw at gdcproject.org

--- Comment #2 from Iain Buclaw <ibuclaw at gdcproject.org> ---
(In reply to FeepingCreature from comment #0)
> In my post A GC Memory Usage Experiment
> https://forum.dlang.org/post/befrzndhowlwnvlqcoxx@forum.dlang.org , I
> suggested the existence of a GC leak caused by downsizing data structures.
> This bug report poses a proof-of-concept for such a leak:
> 
> struct S {
>     S[] parent;
> }
> 
> void main() {
>     S parent;
>     while (true) {
>         S[] link = [S(null), parent];
>         link.length = 1;

I assume no zeroing is done here because you might have other slices to the
data.

    auto slice = link[0 .. $];
    link.length = 1;
    assert(slice[1] == parent);

--


More information about the Digitalmars-d-bugs mailing list