[Issue 1282] Very strange GC problem, memory corruption
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jun 21 12:45:07 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1282
------- Comment #6 from deewiant at gmail.com 2007-06-21 14:45 -------
Pseudocode, closer to the original situation:
struct S { contains pointers and classes }
S* ps;
S[] ss;
void main() {
ss ~= S();
for (;;) {
for (size_t i = ss.length; i-- > 0;) {
ps = &ss[i];
do stuff, use ps, mess with the heap
heap allocation, dynamic array usage aplenty
if (condition) {
delete ps;
ss = ss[0..i] ~ ss[i+1..$];
continue;
}
}
}
}
I don't know pretty much anything about the inner workings of the GC, but maybe
the above can clarify why something went wrong?
If not, feel free to take a detailed look at what happens when the delete in
the main loop is executed (in ccbi.d in the evil_bug.zip I uploaded). Maybe you
can find a deeper problem.
--
More information about the Digitalmars-d-bugs
mailing list