www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 150] New: std.gc.minimize doesn't minimize physical memory usage

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

           Summary: std.gc.minimize doesn't  minimize physical memory usage
           Product: D
           Version: 0.157
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: thomas-dloop kuehne.cn


As shown by the code below, std.gc.minimize doesn't have reduce the physical
memory usage as advertised.


import std.gc;
import std.stdio;

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;
        byte* b = new byte[len];

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

        delete b;
        b = null;

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

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

        return 0;
}


-- 
May 21 2006