GC.forget() (Was: O(N) Garbage collection?)

Nick Sabalausky a at a.a
Sat Feb 19 19:39:10 PST 2011


"bearophile" <bearophileHUGS at lycos.com> wrote in message 
news:ijpkh8$232r$1 at digitalmars.com...
> dsimcha:
>
>> Yeh, I rebuilt the same model in my head over the past few hours (like
>> you, I had a good mental model of the GC at one point but have slowly
>> forgotten it).
>
> For serious D programmers having such model in the head is so important 
> that I'd like a short page with such explanations & pseudocode in the D 
> site :-)
>

I seem to remember finding out at one point (the hard way) that arrays of 
primitives are scanned for pointers unless you explicitly tell the GC not to 
do so (for each array). A long time ago, this caused me major headaches when 
I tried to write a batch processing tool for image files. I never actually 
verified this, but my understanding was that the file and image data 
contained false pointers that prevented the data from completed images from 
being collected. So the program just happily kept munching away at more and 
more memory (and presumably, more false pointers) with each image until 
after only a fairly small number of files it ground to a sputtering halt 
under the weight of its own memory footprint.





More information about the Digitalmars-d mailing list