Memory leak in

Issue #43 resolved
René Dudfield created an issue

== , 2010-03-31 04:33:04 -0700

{{{ Created attachment 33 Program to test the memory leak. Comment line 32 and try again

I think I detected a memory leak with the function, but I am a beginner so perhaps I do something wrong. Using python 2.6.2, pygame 1.9.1, windows XP.

I used Windows Task Manager to detect the leak. }}}

Attachments: [[|]]

== Jonathan Berry, 2010-05-28 09:49:35 -0700

{{{ I ran into this too. I took a look at the code and noticed that saving PNGs loads the imageext module while saving BMPs does not. I switched to saving BMPs and my code no longer leaks memory. So the problem is somewhere in the PNG saving code. Have not tried JPG, but that might help narrow it down further. }}}

== Marco Lettere, 2010-12-03 03:44:53 -0800

{{{ Jpeg is stable as BMP. PNG is causing memory leak also for me (AMD SMP 64 BIT - Ubuntu 10.04, pygame 1.9.1) }}}

== Winston Ewert, 2011-02-14 12:01:50 -0800

{{{ Created attachment 38 patch to fix the memory leak

The write_png function was not deallocating the structures it created in the png library. This adds the call to make sure that both structures are deallocated.

The patch does not correctly handle a specific error case. I don't see how to handle it. (details in comment in patch). However, that is an unlikely case and the only problem remaining is the memory leak.

No test case added as I'm not sure how to write a test on a memory leak. }}}

Attachments: [[| png_leak.patch]]

Comments (5)

  1. René Dudfield reporter

    Fixes #43. Memory leak in with png files, in the imageext.c write_png function.

    Thanks Winston Ewert for the patch. Thanks Jonathan Berry, and Marco Lettere for work on the bug.


  2. Log in to comment