Thread overview | ||||||
---|---|---|---|---|---|---|
|
October 30, 2009 [Issue 3454] New: Inconsistent flag setting in GC.realloc() | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from David Simcha <dsimcha@yahoo.com> 2009-10-29 17:26:42 PDT --- 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: ------- |
October 25, 2013 [Issue 3454] Inconsistent flag setting in GC.realloc() | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | 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 --- Comment #1 from safety0ff.bugz <safety0ff.bugz@gmail.com> 2013-10-25 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: ------- |
October 28, 2013 [Issue 3454] Inconsistent flag setting in GC.realloc() | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | http://d.puremagic.com/issues/show_bug.cgi?id=3454 safety0ff.bugz <safety0ff.bugz@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #2 from safety0ff.bugz <safety0ff.bugz@gmail.com> 2013-10-27 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: ------- |
Copyright © 1999-2021 by the D Language Foundation