[Issue 1561] AA's create many false references for garbage collector

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jan 24 07:24:16 PST 2015


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

AndyC <andy at squeakycode.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andy at squeakycode.net

--- Comment #3 from AndyC <andy at squeakycode.net> ---
tested on DMD v2.066.1

Also without gc.getStats, just watching top.

No memory leak detected.

It actually acts the same for me with or without the call to GC.collect();

As this report includes both D1 and D2, and its not an issue in D2, I'd
recommend closing.

My Test:
import std.stdio;

// Just an ordinary AA with a lot of values.
// neither keys nor values look like pointers.
class BigAA
{
    int[int] aa;
    this() {
        for(int i=0;i<1000;i++) {
            aa[i] = i;
        }
    }
}

void main()
{
    int nloops = 10_000;
    auto b = new BigAA[100];

    for(int i=0; i<nloops; ++i)
    {
        // Create some AAs (overwriting old ones)
        foreach(ref v; b)
        {
            v = new BigAA;
        }
        //GC.collect();
    }
}

--


More information about the Digitalmars-d-bugs mailing list