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 _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Hi Mariano,
2010/7/19 Mariano Martinez Peck <[hidden email]> 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.
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.
_______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Mariano Martinez Peck
On Mon, Jul 19, 2010 at 6:16 AM, Mariano Martinez Peck <[hidden email]> wrote:
yes. I am 99% sure the answer is true. If so: 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.
HTH Eliot _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |