On 02/10/2007, Adam Olsen <[EMAIL PROTECTED]> wrote:
>
> On 10/1/07, Greg Ewing <[EMAIL PROTECTED]> wrote:
> > Justin Tulloss wrote:
> > > Would
> > > somebody care to give me a brief overview on how the current gc module
> > > interacts with the interpreter
> >
> > The cyclic GC kicks in when memory is running low. Since
>
> This isn't true at all.  It's triggered by heuristics based on the
> total number of allocated objects.  It doesn't know how much memory is
> available and is not called if an allocation fails.


Correct.  And that reminds me of the limitation of the the Python GC: it
doesn't take into account how much memory is being indirectly retained by a
Python Object.  Like in the example I already gave, gtk.gdk.Pixbuf can
easily hold hundreds of megabytes, yet the GC gives it as much consideration
as it does to a simple python integer object which is several orders of
magnitude smaller.

If someone wanted to improve the GC, that person should consider adding a
protocol for the GC to retrieve the ammount of memory indirectly held by a
python object, and take such memory into consideration in its heuristics.

-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to