[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
I found a good (Windows, Commercial) memory leak detector called "Memory Validator" and run my Allegro 5 game through
it. It found 6 or so memory leaks in Allegro. I looked at the first two and they are genuine leaks, and I haven't
checked the others out yet fully but they appear to be real leaks too. I will fix them shortly if I can, but the one
major one I am posting a patch for now. I think Milan made the font addon use subbitmaps so he can probably verify if
this is correct.
Index: addons/font/font.c
===================================================================
--- addons/font/font.c (revision 12255)
+++ addons/font/font.c (working copy)
@@ -190,8 +190,14 @@
for(i = cf->begin; i < cf->end; i++) al_destroy_bitmap(cf->bitmaps[i - cf->begin]);
/* Each range might point to the same bitmap. */
- if (cf->glyphs != glyphs) al_destroy_bitmap(cf->glyphs);
+ if (cf->glyphs != glyphs) {
+ al_destroy_bitmap(cf->glyphs);
+ cf->glyphs = NULL;
+ }
+ if (!next && cf->glyphs)
+ al_destroy_bitmap(cf->glyphs);
+
_AL_FREE(cf->bitmaps);
_AL_FREE(cf);
Trent :{)>