[pygtk] More Help: Problems with the solution to: threads and pygtk

Chris Lambacher chris at kateandchris.net
Sat Oct 7 03:18:54 WST 2006


On Fri, Oct 06, 2006 at 11:43:06AM -0700, David Hirschfield wrote:
> It appears to.
> I still don't like it one little bit.
> 
> Placing the gc.disable() just before my thread code starts to do 
> anything, and the gc.enable() right after it finishes solves the 
> freezing problem.
> Of course, I assume that means that cyclic garbage collection is turned 
> off for all threads that run between the time I call gc.disable() and 
> gc.enable(), not just the processing thread.
> 
> When I get a chance I'll have to make a test case that exhibits this 
> problem clearly so someone can look at it carefully and figure out why 
> it's an issue.
You might be able to show an adverse interaction between gc and gtk by putting
gc.collect() in place of your database work.  I would suspect that the only
thing that your db lib is contributing to this is triggering the automatic
case of garbage collection.  

-Chris
> -DavidV
> 
> Stephen Langer wrote:
> >
> >On Oct 5, 2006, at 5:30 PM, David Hirschfield wrote:
> >
> >>Here's the issue now: I don't know much about how the garbage 
> >>collector works in python, and in order to get the thread to run 
> >>without freezing, I'm wrapping the threaded processing function with 
> >>calls to gc.disable()/gc.enable().
> >
> >Will that work?  Does calling gc.disable() on a thread disable garbage 
> >collection for all threads, or only for the calling thread?  I suspect 
> >that what you want to do is to call gc.disable() once, and then call 
> >gc.collect() explicitly on the main thread (or whichever thread is 
> >handling gtk).
> >
> > -- Steve
> >
> >-- 
> >-- EMail: stephen.langer at nist.gov                    Phone: (301) 
> >975-5423 --
> >-- WWW:  http://math.nist.gov/mcsd/Staff/SLanger/    Fax:   (301) 
> >975-3553 --
> >-- Mail: NIST; 100 Bureau Drive -- Stop 8910; Gaithersburg, Md  
> >20899-8910 --
> >
> >-- "I don't think this will work.  That's why it's 
> >science."               --
> >--                              Naomi Langer (age 6),  17 Feb 
> >2003         --
> >
> >
> >_______________________________________________
> >pygtk mailing list   pygtk at daa.com.au
> >http://www.daa.com.au/mailman/listinfo/pygtk
> >Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
> >
> 
> -- 
> Presenting:
> mediocre nebula.
> 
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


More information about the pygtk mailing list