Hi Mariano,

2010/7/19 Mariano Martinez Peck <[email protected]>

> 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:
>
> yes, you were right, objects are moved in memory.


> 1) Who moves them ? the GC?
>

yes, and depends on the GC there are moved to different areas, at different
point in times, etc.


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

The event is that there is no more memory to allocate in the space the
object is being created... for example in a generation scavenging gc, when
the new space is full, it triggers and scavenging and objects are moved to
other new space or they are tenured to the old space.
When the old space is  full, it usually triggers a mark & sweep where object
are moved again.


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

There are two important things to do with memory management: allocate and
deallocate :-)
Allocation and deallocation could lead to memory fragmentation and that
could lead to slow memory allocation (for example, looking for a spot to
allocate the object) or to the impossibility to allocate an object even
though summing the free space in the small chunks you have memory for that
object...
Generation scavenging solved the fragmentation problem in the new space in a
very clever way (as Ungar usually do things :-) ). Objects are created one
after the other (in the memory space I mean) and when the new space is full,
only survivors are copied to the other new space, putting them one behind
the other at the same time, so no fragmentation after scavenging...


> 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 ?
>

that depends on each smalltalk implementation, there is usually a way to do
that because some objects are used to communicate with the operationg system
and those objects can not be moved (for example). In Visual Age there is a
fix object space were you can put those objects, so the gc do not reach them
and the programmer is the responsible to deallocate them. Not sure if
phare/squeak have that option.
Also, if I'm not wrong, the squeak vm does not use scavenging...
I believe it only uses mark & sweep, but not sure there, I may be wrong.


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

I have a lot of papers about that. I send them to you personally.
Also, if you want to see how the gc on squeak vm works, use the interpreter
simulator! that is great. If you need and image to run that, let me know. I
used it for my thesis a long time ago (well... long, 10 year ago :-) ) and
it was great.

Bye,
Hernan.

>
> Thank you very much in advance,
>
> Mariano
>
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to