On Sun, Aug 25, 2002 at 12:13:36AM -0400, Tanton Gibbs wrote: > > In my understanding, no. One possible implementation is to set a flag when > > we create an active_destruction PMC (like IO::File), and perform dod runs > > at every block close until we don't have any such PMCs left. > > I earlier advocated something similar to this; however, I don't think it > is fruitful to check to see if there are any such PMCs left. Basically, > I would just have a global flag and then if any PMC ever requests > deterministic destruction, then set the flag and never unset it. The > reason I would not check for destruction is because I don't think it > will provide any benefit mainly because they will more than likely 1.) > continue to create these objects or 2.) not destroy the current object. > If the case is 1, we will just be forced to increment and decrement the > flag over and over again uselessly and in the case of 2 we won't update > the flag, but it won't ever be incremented or decremented and we're back > to where we started. The only real need for keeping track of > active_destruction PMCs is if one were created by a module and destroyed > in the same function (or around the same function) and that module was > never called again (say reading a properties file). However, given the > probable paucity of such modules, I think the overhead required in > implementing that is enough to bring its demise. Therefore, I continue > to suggest using a single boolean flag to say whether or not a DOD run > should be performed at every function exit. If any class requests > deterministic destruction, then the flag will be set; otherwise it will > remain unset. Once set, it should never be unset.
In this case, it is quite likely that many programs will get that flag set. In which case, we'll need to be doing a DOD run at the end of most blocks (not just functions, mind you). At which point we're going to take a big perfomance hit. At which point some form of ref counting may become preferable :-( -- You live and learn (although usually you just live).