Are you doing anything with threading (I see you are making a call to
pythoncom.GetInterfaceCount()? If so check out

http://stackoverflow.com/questions/16367328/memory-leak-in-threaded-com-object-with-python/16617092#16617092

I've had an issues with a leak and win32 and this took care of it. I have
had a couple other problems with win32 and memory leaks and eventually I
just throw the code execution in a separate python.exe process using
multiprocessing so that the entire memory space is isolated and released
when I end that process. Not very clean, but it works.

On Fri, Jan 16, 2015 at 6:00 AM, <python-win32-requ...@python.org> wrote:

> Send python-win32 mailing list submissions to
>         python-win32@python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://mail.python.org/mailman/listinfo/python-win32
> or, via email, send a message with subject or body 'help' to
>         python-win32-requ...@python.org
>
> You can reach the person managing the list at
>         python-win32-ow...@python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of python-win32 digest..."
>
>
> Today's Topics:
>
>    1. Possible memory leak in pywin32 (Kapil Dolas)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 16 Jan 2015 16:13:21 +0530
> From: Kapil Dolas <kapile...@gmail.com>
> To: python-win32@python.org
> Subject: [python-win32] Possible memory leak in pywin32
> Message-ID:
>         <
> cajpvlshb4q6jcmwevkxh9towfju4n8r9fcgvxb6-yl8e-s4...@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi,
>
> I am using pywin32's mapi module to read data from PSTs. I have shared my
> program which reads email and attachment data here
> <http://pastebin.com/2AXy3BVH> (http://pastebin.com/2AXy3BVH). Currently,
> program is not storing any of the read data. But, still I can see gradual
> increase in memory usage when I run the program over large PST. That PST
> contains around 9000 emails and it has 9 GB of data. Max size of email is
> 24 MB only. For this PST, program's initial memory usage is about 10 MB,
> but it gradually increases and reaches to 40-45 MB. I don't know why this
> memory usage increases up to this value. I have tried using pympler to find
> the root cause, but without any success. It appears that memory increase is
> not due to python objects. Can you point out the reason behind (gradual)
> increase in memory usage? Is it due to the memory leak in pywin32, or any
> mistakes in my program?
>
> Regards,
> Kapil Dolas
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.python.org/pipermail/python-win32/attachments/20150116/5108d64b/attachment-0001.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> python-win32 mailing list
> python-win32@python.org
> https://mail.python.org/mailman/listinfo/python-win32
>
>
> ------------------------------
>
> End of python-win32 Digest, Vol 142, Issue 8
> ********************************************
>
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to