March 08, 2013Re: Ideas for runtime loading of shared libraries.
Posted in reply to Walter Bright
On 03/08/2013 01:17 AM, Walter Bright wrote: > On 1/2/2012 11:20 AM, Martin Nowak wrote: >> - Libraries might not be unloaded as long as GC collected class >> instances >> still exist because >> finalization fails otherwise. > > D doesn't guarantee that finalizers will run on GC allocated objects. > Therefore, when unloading a dll: > > 1. run a gc collection > 2. for all objects remaining on the heap > if they have a finalizer and that finalizer points into the dll > code > mark them as not having a finalizer Yeah, that's the pragmatic solution. I don't really like the 2. point though but that won't be a problem with the current GC. It also avoids the false pointer problems of the GC.trackRange approach.