<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Sprechblasentext Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.E-MailFormatvorlage18
        {mso-style-type:personal-reply;
        font-family:"Arial","sans-serif";
        color:windowtext;
        font-weight:normal;
        font-style:normal;}
span.SprechblasentextZchn
        {mso-style-name:"Sprechblasentext Zchn";
        mso-style-priority:99;
        mso-style-link:Sprechblasentext;
        font-family:"Tahoma","sans-serif";
        color:black;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext">Hi, Peter,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext">There is at least one known memory leak problem with IronPython. However, it only affects the case when you run lots of python scripts within
 the same process, not when a single python script is running (as an application):<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext"><a href="http://ironpython.codeplex.com/workitem/31764" title="Follow link"><span lang="EN-US">http://ironpython.codeplex.com/workitem/31764</span></a></span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext">Recently, there was some progress in debugging of the problem, but it is not solved yet.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext">Usually, it is not good practice to call GC.Collect() explicitly, except in cases when you certainly know that there is a huge amount of memory
 which is to be released now.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext">There are certain knobs you can use to tweak the garbage collection algorithms. Especially the ServerGC setting brought a 200% speedup on a compute
 and memory allocation intense c# application (geodata processing) on a 64 Bit multi-CPU machine, on the cost of about 200MB more memory usage (of about 2.5G total).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext">Google will give you many helpful links like<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext"><a href="http://msdn.microsoft.com/de-de/library/0xy59wtx%28v=vs.110%29.aspx">http://msdn.microsoft.com/de-de/library/0xy59wtx%28v=vs.110%29.aspx</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext"><a href="http://msdn.microsoft.com/en-us/library/ms229357%28v=vs.110%29.aspx">http://msdn.microsoft.com/en-us/library/ms229357%28v=vs.110%29.aspx</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext"><a href="http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx">http://www.atalasoft.com/cs/blogs/rickm/archive/2008/08/20/changing-your-garbage-collector-settings-on-the-fly-net-memory-management-part-5.aspx</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext"><a href="http://msdn.microsoft.com/en-us/library/x2tyfybc.aspx">http://msdn.microsoft.com/en-us/library/x2tyfybc.aspx</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">Best regards<br>
<br>
Markus Schaber</span><span lang="EN-US" style="color:windowtext"><br>
<br>
</span><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">CODESYS<sup>®</sup></span></b><span lang="EN-US" style="color:windowtext">
</span><span lang="EN-US" style="font-size:8.0pt;font-family:"Arial","sans-serif";color:#B1B2B3">a trademark of 3S-Smart Software Solutions GmbH</span><span lang="EN-US" style="color:windowtext">
<br>
</span><b><span lang="EN-US" style="font-size:2.0pt;font-family:"Arial","sans-serif";color:#636363"><br>
</span></b><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">Inspiring Automation Solutions
</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363"><o:p></o:p></span></p>
<div>
<div class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">
<hr size="1" width="636" style="width:477.0pt" noshade="" style="color:#636363" align="left">
</span></div>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">3S-Smart Software Solutions GmbH
<br>
Dipl.-Inf. Markus Schaber | Product Development Core Technology <br>
Memminger Str. 151 | 87439 Kempten | Germany <br>
Tel. +49-831-54031-979 | Fax +49-831-54031-50 <br>
<br>
E-Mail: </span><a href="mailto:m.schaber@codesys.com"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#E3000F;text-decoration:none">m.schaber@codesys.com</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">
 | Web: </span><a href="http://www.codesys.com"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#E3000F;text-decoration:none">codesys.com</span></a><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">
<span lang="EN-US">| CODESYS store: </span></span><a href="http://store.codesys.com"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#E3000F;text-decoration:none">store.codesys.com</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">
<br>
CODESYS forum: </span><a href="http://forum.codesys.com"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#E3000F;text-decoration:none">forum.codesys.com</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">
<br>
<br>
</span><i><span lang="EN-US" style="font-size:8.0pt;font-family:"Arial","sans-serif";color:#636363">Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner</span></i><span lang="EN-US" style="font-size:8.0pt;font-family:"Arial","sans-serif";color:#636363">
 | <i>Trade register: Kempten HRB 6186</i> | <i>Tax ID No.: DE 167014915</i></span><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">
</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:windowtext"><o:p></o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">Von:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"> Ironpython-users [<a href="mailto:ironpython-users-bounces+m.schaber=codesys.com@python.org">mailto:ironpython-users-bounces+m.schaber=codesys.com@python.org</a>]
<b>Im Auftrag von </b>Peter Schwalm<br>
<b>Gesendet:</b> Dienstag, 10. </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">Dezember 2013 05:29<br>
<b>An:</b> Slide<br>
<b>Cc:</b> ironpython mailList<br>
<b>Betreff:</b> Re: [Ironpython-users] memory fragmentation oder leak in ironpython program / I apologize<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">Hallo Slide,<br>
<br>
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.<br>
<br>
... 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.<br>
<br>
But I still have no safe way to analyze such problems, and there are still questions which I don't have an answer for:
<br>
<br>
Is ipy kosher in it's memory handling? <br>
Where does this ever growing number of GCHandles (shown by sysinternals procexp) come from? Can I simply ignore it?<br>
Is it good practice to use explicit GC.Collect()-calls?<br>
<br>
If anyone can share her/his experience in these fields, I would be happy.<br>
<br>
Thanks in advance<br>
Peter Schwalm<br>
<br>
<br>
<br>
<br>
<br>
Am 10.12.2013 02:19, schrieb Slide:<o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p><span lang="EN-US">Does itextsharp implement idisposable for any objects you are using?<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">On Dec 9, 2013 5:19 PM, "Peter Schwalm" <</span><a href="mailto:ps@peter-schwalm.de"><span lang="EN-US">ps@peter-schwalm.de</span></a><span lang="EN-US">> wrote:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Hello,<br>
<br>
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.<br>
<br>
I have already in .net GC garbage collection calls which made the situation something better (before that it was still worse).<br>
<br>
Does anyone know if this could a fragmention problem? And what I could against it?<br>
<br>
Another peculiarity:<br>
<br>
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.<br>
<br>
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?<br>
<br>
Thanks in advance,<br>
Peter Schwalm<br>
<br>
<br>
_______________________________________________<br>
Ironpython-users mailing list<br>
</span><a href="mailto:Ironpython-users@python.org" target="_blank"><span lang="EN-US">Ironpython-users@python.org</span></a><span lang="EN-US"><br>
</span><a href="https://mail.python.org/mailman/listinfo/ironpython-users" target="_blank"><span lang="EN-US">https://mail.python.org/mailman/listinfo/ironpython-users</span></a><span lang="EN-US"><o:p></o:p></span></p>
</div>
</blockquote>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
</div>
</body>
</html>