[Ironpython-users] memory fragmentation oder leak in ironpython program / I apologize

Peter Schwalm ps at peter-schwalm.de
Tue Dec 10 05:29:05 CET 2013

Hallo Slide,

thank you for your answer. I don't knwo if iTextSharp uses IDisposable. 
I admit, I use it as a block box, but at least I suppose it's well 
written, because I think it is a proven tool.

... and I apologize: I have found the mistake in my own code now. It was 
a list which - unnecessarily - grew with every document and which was 
worked upon rather costly. So I caused the problem myself. The program 
has a constant throughput, and for now I'm happy.

But I still have no safe way to analyze such problems, and there are 
still questions which I don't have an answer for:

Is ipy kosher in it's memory handling?
Where does this ever growing number of GCHandles (shown by sysinternals 
procexp) come from? Can I simply ignore it?
Is it good practice to use explicit GC.Collect()-calls?

If anyone can share her/his experience in these fields, I would be happy.

Thanks in advance
Peter Schwalm

Am 10.12.2013 02:19, schrieb Slide:
> Does itextsharp implement idisposable for any objects you are using?
> On Dec 9, 2013 5:19 PM, "Peter Schwalm" <ps at peter-schwalm.de 
> <mailto:ps at peter-schwalm.de>> wrote:
>     Hello,
>     I have an ipy script that manipulates several thousand .pdf
>     documents in a single run via itextsharp. I observe that it is
>     permanently getting slower. After starting the program it
>     processes about 10 documents per second, after processing 5000
>     documents it does only process 3 oder 4 docs per second.
>     I have already in .net GC garbage collection calls which made the
>     situation something better (before that it was still worse).
>     Does anyone know if this could a fragmention problem? And what I
>     could against it?
>     Another peculiarity:
>     in sysinternals procexp I can see that the memory usage rises
>     during the excecution, but - after I inserted the GC.Collect()
>     calls - relative moderately. What rises constantly are the GC
>     handles (about 170.000 after 8000 documents). If I read the docs
>     it looks as if GCHandles are handles that make managed memory
>     accessible for non-managed programs.
>     Does anyone know where these GC handles come from, if they could
>     be the cause of my problems and what I could do against them?
>     Thanks in advance,
>     Peter Schwalm
>     _______________________________________________
>     Ironpython-users mailing list
>     Ironpython-users at python.org <mailto:Ironpython-users at python.org>
>     https://mail.python.org/mailman/listinfo/ironpython-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20131210/3f78a811/attachment.html>

More information about the Ironpython-users mailing list