why should I use al_malloc() over malloc()?
gentix

The manual says that al_malloc is

manual said:

Like malloc() in the C standard library, but the implementation may be overridden.

what does that mean? Overriding the implementation with what? Is there a reason I should be using al_malloc? And most importantly, should I be using the al_ memory functions differently from how I use malloc() and friends?

Jeff Bernard

al_malloc() calls malloc() unless you override the memory management functions with al_set_memory_interface().

Dizzy Egg

Going out on a limb (or boxing glove), I'm betting gentix is more confused now than pre-post. :-*

torhu

It's just that you can override al_malloc and friends with versions that log memory allocations for debugging purposes. In short, it probably doesn't matter either way which you use ;)

If you are curious you can read memory.c and memory.h in Allegro's source, they are short and easy to understand.

Peter Wang

A few functions require you to use al_malloc or al_free. This will be mentioned in the documentation. Apart from being overridable, the version of malloc/free that Allegro sees may not necessarily match the malloc/free that your program sees.

Thread #612517. Printed from Allegro.cc