C (34/304)

From:Jack York
Date:05 Aug 2000 at 21:02:31
Subject:memory allocation fcns

Hello,

I'm looking for some advice on which memory allocating fcn I
should use.

I have always used AllocVec since it's so easy and less prone to my
fat fingers putting in wrong values. But I am starting a new
project and thought I would give pools a try. So my questions are:

1) What is the recommended or most generally used fcn of the
three (AllocPooled, AllocVec, AllocMem)?

2) How does malloc fall into this comparison? Is it used mainly
only if portable code is desired or are there other reasons?

3) Does it make much difference as far as program size/speed
as to which fcn is used?

4) I saw mentioned before that if pools are used, it is better to
allocate a different pool for each type (one for int, one
for char, etc.). Is this the case?

5) Not that I would do this but...if pools are used, is it necessary
to check if puddles have been allocated once the pool has been
obtained? That is, do you need to say if ( ptr = AllocPooled (
instead of just ptr = AllocPooled (
Just curious on this one. The few code examples I've seen that
use pools verify the memory was obtained but it did raise the
question.

Jack