OK, here is the code I (mostly) took from wiki:
I also added the _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF |_CRTDBG_LEAK_CHECK_DF ) line which is a crt function which spots memory leaks and dumps them to output at program termination (http://msdn.microsoft.com/en-us/library/vstudio/x98tx3cf.aspx)
When the program terminates, I get the following output:
Detected memory leaks!
Dumping objects -> {564} normal block at 0x007CB008, 65536 bytes long. Data: <+Da +Da +Da +Da > 2B 44 61 FF 2B 44 61 FF 2B 44 61 FF 2B 44 61 FF Object dump complete.
I then set a breakpoint at block 564 allocation, and this block is allocated when allegro bitmap is loaded, specifically, in _al_d3d_create_bitmap(), you can see attachment to get the idea where it is.
Memory for d3d bitmap is probably not deallocated at program termination, despite explicit call to allegro_destroy_bitmap().
Or it may be false positive.
65536 bytes! Zomg!
Actually, there must be an error in this tutorial: http://wiki.allegro.cc/index.php?title=Basic_tutorial_on_loading_and_showing_images
When I free the image BEFORE freeing the display (which uses this image, probably), no memory leaks are detected.
I must say, though, that it is not specified anywhere, although seems natural. However, this tutorial really confused me.
P.S.: Can I edit the order of these calls in wiki?
Of course you can. Any contribution to the wiki is welcome and appreciated.
When you destroy the display first, the bitmap is converted to a memory bitmap. So perhaps that process is leaking some memory.
It shouldn't though. If no one else takes this, I'll look into it after my holiday.
Holidays are the perfect time to work on side projects.
Unfortunately, not so if they are family holidays. Ah well, that's what it's like to be a father.
Nah, nothing says you actually have to spend all of your time on a holiday catering to your family