On Tue, Jun 03, 2003 at 07:24:04PM -0400, Benjamin Goldberg wrote: > IIRC, DoD normally happens something vaguely like this: > > for my $p (@all_pmcs) { > clear_is_live_flag($p); > } > our $traverse; > sub set_is_live_flag($p) { > if( !test_is_live_flag($p) and test_is_agregate($p) ) { > $traverse = [$p, $traverse]; > } > really_set_is_live_flag($p); > } > set_is_live_flag($_) for @rootset; > while( $traverse ) { > ((my $p), $traverse) = splice @$traverse; > $p->set_live_flag_on_contained_objects(); > } > for my $p (@all_pmcs) { > next if test_is_live_flag($p); > free_pmc($p); > }
This is something that has concerned me for a while. But does DoD ensure any kind of ordering for the destruction ? I ask becasue what happens if an object actually wants to use its contents during its DESTROY ? For example Net::POP3::DESTROY will send a reset command to its server if the user did not call the quit method first. But how could it do this if the socket PMC was already freed ? Graham.