POV-Ray : Newsgroups : povray.off-topic : A tale of two cities : Re: A tale of two cities Server Time
4 Sep 2024 19:00:41 EDT (-0400)
  Re: A tale of two cities  
From: Invisible
Date: 14 Mar 2012 12:29:32
Message: <4f60c76c$1@news.povray.org>
>> If you're using garbage collection, it's quite possible - and, indeed,
>> usual. Each time the GC collects the garbage, it also defragments the
>> free space. You therefore need only store a pointer to the next free
>> byte of memory. To allocate, just increment this pointer by the size of
>> the block allocated. Allocation is now O(1) in time and space.
>
> So far, so good. But how does the GC know how long each chunk of
> garbage-to-collect is?

The GC engine needs to know quite a bit about the objects it's scanning 
- how big they are, where their pointer fields are, etc. It also usually 
needs access to each thread's stack, to see what local variables are 
pointing to objects. And so on and so forth. There's a /reason/ why it's 
usually hard-coded into the language run-time system rather than being 
an add-on library.


Post a reply to this message

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