Hello,<br><br>I made some basic checks in this problem (quantize error) and have following results now:<br><br>I&#39;ve added gc debugging to a script, tried to force collection, but at the time when quantize error happens gc says that there is no leaks.<br>
So I&#39;ve decided to check C implementation of quantize() function and wrote small utility that uses C part of PIL for image quantization. Library is too old, so there is no leaks in quantize() of course :)<br>Debugging of script shows that after processing some files malloc returns 0 (usually it in Quant.c : 1265). Sometimes I get python MemoryError exception after receiving &quot;quantization error&quot;, sometimes not. As for memory allocation process it looks like: 7 MB (at start) --&gt;&nbsp; processing --&gt; 50 MB --&gt; seems gc begins working here --&gt; 7 MB -&gt; repeat N times -&gt; quantization error.<br>
Now I have some assumptions about it:<br><br>a) Possible memory leak somewhere in split/eval/paste functions. I can check them, but I don&#39;t think it will give any results.<br>b) Leak somewhere in a glue code. Cycle references/memmove ?<br>
<br>I have similiar subjects at other mailing lists, maybe they will give some ideas:<br><a href="http://mail.python.org/pipermail/image-sig/2007-December/004720.html">http://mail.python.org/pipermail/image-sig/2007-December/004720.html</a><br>
<a href="http://mail.python.org/pipermail/image-sig/1999-April/000713.html">http://mail.python.org/pipermail/image-sig/1999-April/000713.html</a><br><a href="http://www.daniweb.com/forums/thread133133.html">http://www.daniweb.com/forums/thread133133.html</a><br>
<br>How will be better to track an allocation/deallocation of Imaging objects? Anyone have C samples of using C part library of PIL? I&#39;d like to rewrite python script that causes an error in C to make sure that there is no leaks at C part, but have to work with png loading/decoding manually, so an example will be great and help to save time which I spend on examination C API.<br>
<br>Any ideas?<br><br><br>Regards, Evgeny.<br><br><br>