On Mar 8, 6:15 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 08 Mar 2007 14:25:02 -0300, <[EMAIL PROTECTED]> escribió: > 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?
That is what I was thinking. A per-thread memory allocator of some sort. What I need is run a lot of commands from a COM object that can be run independently. There commands leak memory, so when the command finishes, the memory consumption jumps to 800MBs or so. Which begs the question, if I initialize the COM object in a separate thread and run the command, does finishing the thread clean up any and all memory the thread used or not. The output of each thread would actually be a file on disk, therefore there is no need to pass any data between the threads and the main program. > > 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"? pythoncom.CoUninitialize(), if I am not mistaken, releases a COM object (and therefore the memory it uses I assume). When the command is run (in PythonWin for example), the memory is not released but persists for quite a while. Using my watch and the Task Manager in Windows I can see that the memory is released approximately 30 seconds AFTER I run the pythoncom.CoUninitialize() command is run. > What memory do you want to release "right away"? The memory I want to release is the memory the COM object used (the one initialized with the win32com Dispatch command). The "right-away" is not much of an issue, but if I can release it before I run each command from the COM object that leaks memory, it would be nice. Running upwards to 800MBs of RAM for one 500 line python script seems a little bit too much for me. Thank you for your reply Gabriel. If you have any more input, I would greatly appreciate it.
-- http://mail.python.org/mailman/listinfo/python-list