[Vm-dev] Are objects moved (changed the address in memory)?

Eliot Miranda eliot.miranda at gmail.com
Mon Jul 19 17:54:39 UTC 2010


On Mon, Jul 19, 2010 at 6:16 AM, Mariano Martinez Peck <
marianopeck at gmail.com> wrote:

>
> Hi. Nebwie here. THe first question is if objects are moved (changed the
> address in memory) at runtime?


yes.


> I am 99% sure the answer is true. If so:
>
> 1) Who moves them ? the GC?
>

yes.


> 2) when ?  agains which events, what triggers these movements?
>

during garbage collection


> 3) why they are moved?  to compact the memory ?  why the memory needs to be
> compact? for arrays?
>

In Squeak's case to compact memory.  But scavenging/two-space-collection is
a widely used technique that works by copying the live objects from one
space into another, com[acting as it goes, and so it is expected with modern
algorithms that memory is compacted as garbage is collected.  See Paul
Wilson's Uniprocessor Garbage Collection
Techniques<http://www.complang.tuwien.ac.at/ulrich/gcsurvey.ps.gz>
.


> 4) Is there a way to say "please, don't move this object X" ?  what would
> be the problem of having a lot of these "non-moveable" objects? memory
> fragmentation ?
>

Not yet.  I'm working on it for Teleplace's threaded Cog VM.



> If you can point me to the code also I would be happy.
>

See the garbage collection and gc protocols in ObjectMemory and (in Cog)
NewObjectMemory in VMMaker.


> Thank you very much in advance,
>
> Mariano
>

HTH
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20100719/485539cb/attachment.htm


More information about the Vm-dev mailing list