[Issue 11021] [GC] Huge GC leak leads to crash; GC uses 7x more memory

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 14 21:07:19 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=11021


safety0ff.bugz <safety0ff.bugz at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #14 from safety0ff.bugz <safety0ff.bugz at gmail.com> 2014-02-14 21:07:09 PST ---
This is due to false pointers as discussed above.

Consider the program at the end of this comment:
Version = A reproduced the claim.
Version !=A uses ~80MiB because of the lower probability of false pointers.
---------- Begin code -----------
import core.memory;
import std.traits;

void main() {
    while(true) {
        GC.collect();
version(A)  auto tmp = cast(ubyte*)GC.malloc(40*1024*1024, GC.BlkAttr.NO_SCAN);
else        auto tmp = cast(ubyte*)GC.malloc(40*1024*1024, GC.BlkAttr.NO_SCAN |
GC.BlkAttr.NO_INTERIOR);
        for (uint i = 0; i < 40*1024*1024; i+= 1024)
            tmp[i] = 0; // poke the memory
        tmp = null;
    }
}
---------- End code -----------

*** This issue has been marked as a duplicate of issue 3463 ***

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


More information about the Digitalmars-d-bugs mailing list