Hello. Seems I found something interesting, please consider att1 code from libImaging of PIL. I think there is will be a memory leak if we goto "done" label from while. Heap will not be freed. I wrote C example which uses ImageNew and ImageQuantize methods. While debugging it under windows with CRT debug malloc/free it shows that this code has two leaks. One is 1024 kb and second is 83 byte per image. So I've just moved ImagingQuantHeapFree(h); call under done label. Since that time VS does not detects any leaks in my example.
Also I've recompile PIL with my fix and I've checked python script which gives quantization error. Memory usage is stable now. (I've tested it under fedora10, not under windows xp yet). My python version is 2.5.2. I know a bit about PIL internals so maybe I wrong. I'd like to know PIL's author opinition about this. Thank you. P.S. median_cut with and without my fix is in attach. I did't make diff, because as I said I'm may be wrong.
att1
Description: Binary data
att2
Description: Binary data
_______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig