Hello, I made some basic checks in this problem (quantize error) and have following results now:
I'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. So I'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 :) 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 "quantization error", sometimes not. As for memory allocation process it looks like: 7 MB (at start) --> processing --> 50 MB --> seems gc begins working here --> 7 MB -> repeat N times -> quantization error. Now I have some assumptions about it: a) Possible memory leak somewhere in split/eval/paste functions. I can check them, but I don't think it will give any results. b) Leak somewhere in a glue code. Cycle references/memmove ? I have similiar subjects at other mailing lists, maybe they will give some ideas: http://mail.python.org/pipermail/image-sig/2007-December/004720.html http://mail.python.org/pipermail/image-sig/1999-April/000713.html http://www.daniweb.com/forums/thread133133.html How will be better to track an allocation/deallocation of Imaging objects? Anyone have C samples of using C part library of PIL? I'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. Any ideas? Regards, Evgeny.
_______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig