[AD] [ alleg-Bugs-2985773 ] two memory leaks |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Bugs item #2985773, was opened at 2010-04-12 10:40
Message generated for change (Tracker Item Submitted) made by fbueren
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105665&aid=2985773&group_id=5665
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Linux
Group: 4.9
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: fbueren (fbueren)
Assigned to: Nobody/Anonymous (nobody)
Summary: two memory leaks
Initial Comment:
By passing my code using Allegro 4.9.19 (Linux) through valgrind, I discovered two minor memory leaks which, I think, are caused by Allegro...
Please correct me if it's my fault... ;)
Leak 1:
==15518== 24 bytes in 4 blocks are definitely lost in loss record 593 of 875
==15518== at 0x4024C1C: malloc (vg_replace_malloc.c:195)
==15518== by 0x43FDBC6: XKeysymToString (in /usr/lib/libX11.so.6.2.0)
==15518== by 0x40C33D1: find_unknown_key_assignment (xkeyboard.c:348)
==15518== by 0x40C3DB5: _al_xwin_get_keyboard_mapping (xkeyboard.c:605)
==15518== by 0x40C414E: xkeybd_init_keyboard (xkeyboard.c:778)
==15518== by 0x40A072A: al_install_keyboard (keybdnu.c:134)
==15518== by 0x805067D: Init() (main.cpp:29)
==15518== by 0x8050B81: main (main.cpp:173)
at xkeyboard.c:348, there is this:
for (j = 0; j < sym_per_key; j++) {
----> char *sym_str = XKeysymToString(keysyms[sym_per_key * (i - min_keycode) + j]);
sprintf(str + strlen(str), " %s", sym_str ? sym_str : "NULL");
}
Leak 2:
==15518== 18,048 bytes in 1 blocks are definitely lost in loss record 870 of 875
==15518== at 0x4024D12: realloc (vg_replace_malloc.c:476)
==15518== by 0x40B2993: default_realloc (memory.c:107)
==15518== by 0x40DABBD: ogl_prepare_vertex_cache (ogl_draw.c:167)
==15518== by 0x40D992F: draw_quad (ogl_bitmap.c:265)
==15518== by 0x40DA998: ogl_draw_bitmap_region (ogl_bitmap.c:461)
==15518== by 0x40DAB4E: ogl_draw_bitmap (ogl_bitmap.c:478)
==15518== by 0x4084124: al_draw_bitmap (bitmap_new.c:206)
==15518== by 0x4105887: color_render_char (font.c:156)
==15518== by 0x41057A7: color_render (font.c:180)
==15518== by 0x41069A0: al_draw_ustr (text.c:58)
==15518== by 0x804ACC6: Console::Draw(ALLEGRO_COLOR) (console.cpp:115)
==15518== by 0x8050981: MainLoop() (main.cpp:139)
at ogl_draw.c:167, there is that:
disp->num_cache_vertices += num_new_vertices;
if(!disp->vertex_cache) {
disp->vertex_cache = _AL_MALLOC(num_new_vertices * sizeof(ALLEGRO_OGL_BITMAP_VERTEX));
disp->vertex_cache_size = num_new_vertices;
} else if (disp->num_cache_vertices > disp->vertex_cache_size) {
----> disp->vertex_cache = _AL_REALLOC(disp->vertex_cache,
2 * disp->num_cache_vertices * sizeof(ALLEGRO_OGL_BITMAP_VERTEX));
disp->vertex_cache_size = 2 * disp->num_cache_vertices;
}
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105665&aid=2985773&group_id=5665