On Tue, Feb 10, 2004 at 04:04:02PM -0600, Liza Klerck wrote:
> I am seeing a significant memory leak when using the 
> set_cell_data_func() method of a gtk.TreeViewColumn. I have included an 
> example program that illustrates the problem, I am using python2.3 on 

It would be best to file this (great) summary in bugzilla.gnome.org so
it doesn't get lost. I'd suggest, if you have a bit more time, trimming
down the testcase to the bare minimum so it's easier to isolate the
problem.

> Each time the rendering function (renderFunc) is called the memory usage 
> increases, even when the rendering function executes no code. When I 
> commend out the call to set_cell_data_func() the memory leak does not 
> occur.

If you have the time, take a look at gtk/gtktreeview.override in the
pygtk source code. In particular, I've noticed that the wrapper for
set_cell_data_func creates four (AFAICS, temporary?) objects for each
call to the function:

    pytreecolumn = pygobject_new((GObject *)tree_column);
    pycell = pygobject_new((GObject *)cell);
    pytreemodel = pygobject_new((GObject *)tree_model);
    pyiter = pyg_boxed_new(GTK_TYPE_TREE_ITER, iter,
                           TRUE, TRUE);
    if (cunote->data)
        retobj = PyEval_CallFunction(cunote->func, "(OOOOO)",
                                     pytreecolumn, pycell,
                                     pytreemodel, pyiter, cunote->data);
    else
        retobj = PyEval_CallFunction(cunote->func, "(OOOO)",
                                     pytreecolumn, pycell,
                                     pytreemodel, pyiter);

The fact that they aren't destroyed nor referenced after the function
exists is suggestive to me, but I can't debug or build at the moment, so
if you could help out the debugging it would be really appreciated.

Johan, do you think we're leaking these objects?

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to