if you use custom memory allocator to replace allegro's default allocator,plz be careful.
before use the method al_set_memory_interface(), allegro use default allocator to malloc/free.So you need al_set_memory_interface before allegro install.
Even if you do so, or have an opportunity to cause a memory leak. like this:
class String is a wrapper of allegro's string methods. Define a local variables in a cpp file.
this string's memory is malloc before the main(), use the default malloc. so you must use default free() to free it. that mean you need use al_set_memory_interface() again, after allegro uninstall, to replace your custom allocator with default.
so ,don't use al_init(), that method will automatic call al_uninstall_system after main().
you need do like this:
hope help you.;D
Those are some good points
We should probably include them in the documentation, assuming they aren't already.
That point about the statically allocated object is a very good one, as it can affect more than just memory management. If you try to call allegro API functions in that object's constructor, things can go horribly wrong.
thank you for your reply. hope it could help someone else
Good points. Thank you for bringing them up.
What's the easiest way to make such a doc contribution from a web browser?
Send a patch to the mailing list (via webmail) or attach to a post on the Allegro Developement forum subsection.
You can also edit the documentation online at https://github.com/liballeg/allegro5/blob/5.1/docs/src/refman/memory.txt (And then submit with "Pull Request".)