[Issue 150] std.gc.minimize doesn't minimize physical memory usage

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 18 14:00:19 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=150


Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |bugzilla at digitalmars.com
         Resolution|FIXED                       |


--- Comment #5 from Walter Bright <bugzilla at digitalmars.com> 2012-01-18 14:00:06 PST ---
Recoding the test case for D1 Phobos:
-------------------
import std.gc;
import std.stdio;
import gcstats;

extern(C) GCStats gc_stats();

void printGC(){
    GCStats stat;
    getStats(stat);

    writefln("poolsize: %s; usedsize: %s; freeblocks: %s; freelistsize: %s;
pageblocks: %s\n",
        stat.poolsize, stat.usedsize, stat.freeblocks, stat.freelistsize,
stat.pageblocks);
}

int main(){
    printGC();

    size_t len = 256 * 1024 * 1024;
    auto b = new byte[len];

    writefln("after allocating %s bytes", len);
    printGC();

    delete b;
    b = null;

    std.gc.fullCollect();
    writefln("after std.gc.fullCollect:");
    printGC();

    std.gc.minimize();
    writefln("after std.gc.minimize:");
    printGC();

    return 0;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list