Are objects moved (changed the address in memory)?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Are objects moved (changed the address in memory)?

Mariano Martinez Peck
 
Hi. Nebwie here. THe first question is if objects are moved (changed the address in memory) at runtime?  I am 99% sure the answer is true. If so:

1) Who moves them ? the GC?
2) when ?  agains which events, what triggers these movements?
3) why they are moved?  to compact the memory ?  why the memory needs to be compact? for arrays?
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 ?

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

Thank you very much in advance,

Mariano

Reply | Threaded
Open this post in threaded view
|

Re: Are objects moved (changed the address in memory)?

Eliot Miranda-2
 


On Mon, Jul 19, 2010 at 6:16 AM, Mariano Martinez Peck <[hidden email]> 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.
 
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