Re: Python threading
- From: test.07@xxxxxxxxx
- Date: 8 Mar 2007 19:38:55 -0800
On Mar 8, 6:15 pm, "Gabriel Genellina" <gagsl-...@xxxxxxxxxxxx> wrote:
En Thu, 08 Mar 2007 14:25:02 -0300, <test...@xxxxxxxxx> 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.
.
- Follow-Ups:
- Re: Python threading
- From: Gabriel Genellina
- Re: Python threading
- References:
- Python threading
- From: test . 07
- Re: Python threading
- From: Gabriel Genellina
- Python threading
- Prev by Date: Re: list of dictionary in embedded Python
- Next by Date: Re: Where to "import"?
- Previous by thread: Re: Python threading
- Next by thread: Re: Python threading
- Index(es):
Relevant Pages
|