C (90/304)

From:Allan Odgaard
Date:12 Aug 2000 at 08:57:52
Subject:Re: memory allocation fcns

On 12-Aug-00, Jack York wrote:

> The only advantage I can see to malloc is the related realloc. Is
> there something similar native to the Amiga that will allow the
> resizing of allocated memory?

There's AFAIK no magic behind this function, it simply calls malloc,
memcpy & free.

Though the advantage of using something like malloc is that you can
overload it, so that you can experiment with different memory
allocation schemes, without having to change your source. You may even
have one scheme were you do mungwall sort of checking, including
incrementing and decrementing a counter, to see if your program leaks
memory etc.

If you use C++ then new & delete are much better. They can be overloaded
on a pr. class basis, and you can also add new arguments to the
operators.

Regards Allan