Python threading

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Mar 8 21:15:49 EST 2007


En Thu, 08 Mar 2007 14:25:02 -0300, <test.07 at gmail.com> escribió:

> I am wondering what happens to a thread in python in relation to
> win32com extensions.
>
> If I create a new thread, that uses the Dispatch method from win32com,
> what happens to the memory allocated in that thread when the thread is
> done. Will the Dispatch release the memory it created, or will the
> memory remain?
>
> The problem rises from the fact that Dispatch does not seem to release
> memory correctly every time. If I include the commands in a thread by
> themselves, will the thread clean up ALL memory it used after it is
> done?

All threads share the same memory space, there is not a "per-thread"  
memory allocator, if that's what you are thinking.
Perhaps you hold a reference to some objects in the Thread object? Or you  
still keep the Thread object itself?

> I did try the pythoncom.CoUnitialize() to release memory, but it
> doesn't seem to work (it does work about 30-45 seconds after the
> command is run).

I don't understand what you say here.
What means "it doesn't seem to work" and "it does work 30 seconds after"?

> Any input is greatly appreciated (on the thread issue or how to use
> the pythoncom.CoUnitiliaze() to make it release memory right away).

What memory do you want to release "right away"?

-- 
Gabriel Genellina




More information about the Python-list mailing list