I used the same tutorial I use every time to check for allegro bugs:
http://wiki.allegro.cc/index.php?title=Basic_tutorial_on_loading_and_showing_images
But I added the line:
al_set_new_display_flags(ALLEGRO_OPENGL);
right before creating the display. I checked with Memory Validator (http://www.softwareverify.com/cpp-memory.php) for leaks after program termination and I get 4 leaks at the end of the program, all of which have something to do with the following calls (I'll put the * marks around the line which memory validator complains about:
1. system.c
236 : /* Check for a user-defined system driver first */ 237 : real_system = find_system(&_user_system_interfaces); 238 : 239 : /* If a user-defined driver is not found, look for a builtin one */ 240 : if (real_system == NULL) { 241 : *real_system = find_system(&_al_system_interfaces);* 242 : } 243 : 244 : if (real_system == NULL) { 245 : active_sysdrv = NULL; 246 : return false;
|
V
2. system.c
|
V
3. wsystem.c
167 : 168 : _al_vector_init(&_al_win_system->system.displays, sizeof (ALLEGRO_SYSTEM_WIN *)); 169 : 170 : _al_win_system->system.vt = vt; 171 : 172 : *d3d_available = maybe_d3d_init_display();* 173 : 174 : return &_al_win_system->system; 175 : } 176 : 177 :
|
V
4. wsystem.c
141 : 142 : 143 : static bool maybe_d3d_init_display(void) 144 : { 145 : #ifdef ALLEGRO_CFG_D3D 146 : *return _al_d3d_init_display();* 147 : #else 148 : return false; 149 : #endif 150 : } 151 :
|
V
5. d3ddisp.cpp
694 : 695 : 696 : ALLEGRO_INFO("Render-to-texture: %d\n", render_to_texture_supported); 697 : 698 : present_mutex = al_create_mutex(); 699 : *_al_d3d_lost_device_mutex = al_create_mutex();* 700 : 701 : _al_d3d_bmp_init(); 702 : 703 : return true; 704 : }
|
V
6. threads.c
281 : ALLEGRO_MUTEX *al_create_mutex(void) 282 : { 283 : ALLEGRO_MUTEX *mutex = al_malloc(sizeof(*mutex)); 284 : if (mutex) { 285 : _AL_MARK_MUTEX_UNINITED(mutex->mutex); 286 : *_al_mutex_init(&mutex->mutex);* 287 : } 288 : return mutex; 289 : } 290 : 291 :
|
V
7. wxthread.c
|
V
8. memory.c
Then there are three more, which also have something to do with creating mutexes in _al_d3d_init_display();
fyi, the code tag comes with a bonus - if you put 3 asterisks after a line of code it will highlight that line of code for you, usually unless it chokes, but it does fine most the time.
Too bad it can't find the offending line of code that frees the mem that doesn't exist yet. Now then it would be a good memory tool.
Fix the leak! Submit a patch against git!
Unfortunately, I'm too noob of a programmer to do that myself.
Why forcing an OpenGL Display should let Allegro Stakc the calls into the D3D submodule?