[Issue 3284] snn linked programs never release memory back to the OS

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Aug 19 17:39:13 PDT 2016


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

Cauterite <cauterite at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cauterite at gmail.com

--- Comment #2 from Cauterite <cauterite at gmail.com> ---
I highly suspect this issue has already been resolved.
Here's a simple test:

import core.memory;
void main() {
    // allocate and free lots of 10MB arrays
    foreach (_; 0 .. 1000) {
        auto x = GC.calloc(10_000_000, 1);
        GC.free(x);
        x = null;
    };

    import std.c.stdio;
    printf("done\n"); getchar();
};

if you remove the `GC.free(x)` the working set will grow to >1GB. if you leave
it in, memory usage is normal ~15MB or so.
so the GC is definitely releasing pages back to the OS when it deallocates.

And before you ask, yes I am linking with SNN.lib

--


More information about the Digitalmars-d-bugs mailing list