digitalmars.D.bugs - [Issue 3454] New: Inconsistent flag setting in GC.realloc()
- d-bugmail puremagic.com (43/43) Oct 29 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3454
- d-bugmail puremagic.com (27/27) Oct 25 2013 http://d.puremagic.com/issues/show_bug.cgi?id=3454
- d-bugmail puremagic.com (10/10) Oct 27 2013 http://d.puremagic.com/issues/show_bug.cgi?id=3454
- d-bugmail puremagic.com (13/13) Oct 31 2013 http://d.puremagic.com/issues/show_bug.cgi?id=3454
http://d.puremagic.com/issues/show_bug.cgi?id=3454 Summary: Inconsistent flag setting in GC.realloc() Product: D Version: 2.035 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: druntime AssignedTo: sean invisibleduck.org ReportedBy: dsimcha yahoo.com GC.realloc() doesn't set the flags on either the old or new memory block for a whole bunch of code paths. I was tipped off to this by reading the code while trying to add precise heap scanning. Here's a test program that demonstrates this. import std.stdio, core.memory; void main() { doTest(1); writeln(); doTest(1024 * 1024); } void doTest(size_t multiplier) { auto foo = GC.malloc(8 * multiplier); auto bar = GC.realloc(foo, 2 * multiplier, GC.BlkAttr.NO_SCAN); writeln("Old block attributes: ", GC.getAttr(foo)); writeln("New block attributes: ", GC.getAttr(bar)); writeln("Old Ptr: ", foo, " New Ptr: ", bar); } Output: Old block attributes: 2 New block attributes: 2 Old Ptr: 961E40 New Ptr: 961E30 Old block attributes: 0 New block attributes: 0 Old Ptr: 10C0000 New Ptr: 10C0000 This is caused by the GC returning early from the B_PAGE path, or if the new block is almost the same size as the old block. If I get precise heap scanning to work, I'll include a fix for this in the patch. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 29 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3454 safety0ff.bugz <safety0ff.bugz gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |safety0ff.bugz gmail.com 12:07:56 PDT --- I believe your test should be: ------------------------------------------------ import std.stdio, core.memory; void main() { doTest(1); writeln(); doTest(1024 * 1024); } void doTest(size_t multiplier) { auto foo = GC.malloc(8 * multiplier); writeln("Old block attributes: ", GC.getAttr(foo)); auto bar = GC.realloc(foo, 2 * multiplier, GC.BlkAttr.NO_SCAN); writeln("New block attributes: ", GC.getAttr(bar)); writeln("Old Ptr: ", foo, " New Ptr: ", bar); } ------------------------------------------------- I've put an ugly fix for this here: https://github.com/Safety0ff/druntime/commit/14148c8184b7094243f5ab74d703027d05c6e73a -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 25 2013
http://d.puremagic.com/issues/show_bug.cgi?id=3454 safety0ff.bugz <safety0ff.bugz gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull 17:01:37 PDT --- https://github.com/D-Programming-Language/druntime/pull/645 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 27 2013
http://d.puremagic.com/issues/show_bug.cgi?id=3454 Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/4fe17c32bcfa9140e3b52e92b27474c3b60b3f95 fix Issue 3454 - inconsistent flag setting in GC.realloc() https://github.com/D-Programming-Language/druntime/commit/487f0a1ed1aad76d1b4ca638fd25b730fd87aa4f regression test for Issue 3454 https://github.com/D-Programming-Language/druntime/commit/0fe338f42a1225a6041bb0f7707375cfbee7b54b fix Issue 3454 - inconsistent flag setting in GC.realloc() -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 31 2013