POV-Ray : Newsgroups : povray.off-topic : A tale of two cities : Re: A tale of two cities Server Time
29 Jul 2024 20:15:36 EDT (-0400)
  Re: A tale of two cities  
From: Warp
Date: 14 Mar 2012 13:09:38
Message: <4f60d0d2@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> If a GC implementation doesn't track free blocks, how is it ever going 
> to re-allocate them to anything?

  A naive implementation of that would be:

  - Resolve the location of all used objects by looking for references
to those objects in the program data.

  - The size of the objects can be resolved from the reference type and/or
a virtual table pointed by the objects themselves.

  - Sort the addresses of the objects.

  - Compact all the objects by moving them towards the beginning of the
heap so that no free space is left between them.

  - Update the "free memory starts from here" pointer to the end of the
last object relocated this way.

  (Of course an actual GC is much, much more complicated than that in
order to make it actually efficient.)

-- 
                                                          - Warp


Post a reply to this message

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