POV-Ray : Newsgroups : povray.off-topic : Question about garbage collection (not a flame) : Question about garbage collection (not a flame) Server Time
1 Oct 2024 09:26:34 EDT (-0400)
  Question about garbage collection (not a flame)  
From: Warp
Date: 30 Mar 2008 08:51:43
Message: <47ef9aee@news.povray.org>
Suppose that we have a dynamically allocated object A, which has as
member a reference to a dynamically allocated object B (allocated by A),
which has a reference to a dynamically allocated object C (allocated by B),
and so on. That is, a long chain of objects, each allocating and owning the
next one.

  Now the reference to A in the actual program code dies, so A is not owned
by anything anymore. The GC engine kicks in at some point. Does it free all
those objects, or does it free A only (and when it's run again at some point
in the future, it frees B only, etc)?

  I assume that it frees all the objects, not just A, but how does it do
it efficiently? (I assume this because else in a circular ownership
situation it would never free any of the objects.)
  Assume that this chain of objects is very large, consisting of thousands
of objects.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.