December 08, 2004 Conflict with opApply and gc code? | ||||
---|---|---|---|---|
| ||||
I'm not sure that this is a bug, but the behavior is so odd that I wanted to see if anyone could explain it. Basically, using foreach within the garbage collector causes an access violation during the final fullcollect on app exit. So far it looks like the crash is occurring in findPool(), but the only explanation I can think of for this behavior is memory corruption. Here are two simple reproducable cases. Insert either of the following blocks on line 1399 of gcx.d (the first line of version(MULTI_THREADED)). I also have an (appropriately broken) copy of gcx.d available here: http://home.f4.ca/sean/d/gcx.d # struct Blah # { # int opApply( int delegate( inout int ) dg ) # { # return 0; # } # } # # Blah blah; # # foreach( int t; blah ) # { # mark( null, null ); # } or # int[int] blah; # # foreach( int t; blah ) # { # mark( null, null ); # } Sean |
Copyright © 1999-2021 by the D Language Foundation