Garbage collection working improperly?
Aahz
aahz at pythoncraft.com
Fri Nov 21 13:18:31 EST 2003
In article <bpli8b$uaf$1 at reader2.nmix.net>,
Jay O'Connor <joconnor at cybermesa.com> wrote:
>Aahz wrote:
>>In article <bplcb9$f4g$1 at reader2.nmix.net>,
>>Jay O'Connor <joconnor at cybermesa.com> wrote:
>>>
>>>I kinda like VisualWorks Smalltalk's approach. It uses a system whereby
>>>new objects are scavenged aggresivly and objects that survive the
>>>scavenger are moved to a different memory space that is not GC'ed nearly
>>>as much. (New objects tend to have short lives..objects that survive
>>>several generations of scavenging tend to live longer) When it's memory
>>>reaches a threshold, it makes a decision as to whether to either request
>>>more from the OS or to GC the old object memory space in an attempt to
>>>free more memory. The nice part is that you can configure a. how much
>>>memory it starts with b. at what point the threshold is set for and
>>>c.the weighting of the algorithim to determine whether to GC or allocate
>>
>>Python does the same thing -- you just can't configure it as much.
>
>I remember this in particular because I was working on an application
>where the performance characteristics were such that for the most part
>we wanted to allocate new memory rather than GC, but then as the memory
>we were using reached a certain point, we wanted to free some of our own
>cached objects so tha the GC could reclaim them. Being able to fine
>tune the memory usage characteristics, and also hooking into
>VisualWork's notification mechanism to be informed when GC was
>happening, proved very important.
Don't forget Python uses a very different memory management system. For
starters, Python's primary mechanism is refcounting rather than GC.
More than that, Python now uses PyMalloc as its standard allocation
system, which does a lot to reduce memory fragmentation. You can adjust
the frequency of GC in Python, but that's about it -- and you don't
really need much more than that, I think.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
Weinberg's Second Law: If builders built buildings the way programmers wrote
programs, then the first woodpecker that came along would destroy civilization.
More information about the Python-list
mailing list