|
why should I use al_malloc() over malloc()? |
gentix
Member #14,246
April 2012
|
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
Member #6,698
December 2005
|
al_malloc() calls malloc() unless you override the memory management functions with al_set_memory_interface(). -- |
Dizzy Egg
Member #10,824
March 2009
|
Going out on a limb (or boxing glove), I'm betting gentix is more confused now than pre-post.
---------------------------------------------------- |
torhu
Member #2,727
September 2002
|
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
Member #23
April 2000
|
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.
|
|