[Vm-dev] What is a free object

Bert Freudenberg bert at freudenbergs.de
Thu Jul 26 17:43:15 UTC 2007


On Jul 26, 2007, at 15:20 , Michael Haupt wrote:

> Hi Mathieu,
>
> On 7/26/07, Mathieu Suen <mathk.sue at gmail.com> wrote:
>> I was reading the code of the nextInstance primitive and  to
>> undertand I need to know what is a FreeObject:
>
> since Squeak (fortunately) has a garbage collector, the heap does not
> just consist of actual objects, but also of chunks of unused memory.
> However, these also have an object header to be more easily handled:
> during allocation, the memory manager must be able to find a free
> piece of heap memory to assign it to the newly allocated object. These
> chunks of free memory are what the VM code calls "free objects".
>
>> Why are they inside the image? When are they created?
>
> They are inside the image because the image is a snapshot of a running
> system, possibly including pieces of free memory. They are created as
> the garbage collector frees memory when objects are deallocated.

Actually they are not in the snapshot - a full garbage collect is  
performed just before snapshotting. This compacts the object memory  
so no free chunks will remain.

- Bert -




More information about the Vm-dev mailing list