[comp.sys.mac.programmer] THINK C Ansi Malloc and Memory handles

felix@ai.sri.com (Francois Felix INGRAND) (01/11/91)

I am fairly new to the C/Mac environment, but from what I read so far about the
Mac, memory seems to be allocated with double pointers (handle) so that the
System can recompact it without breaking your code.

Now, if you use the malloc defined in the ANSI C library of THINK C 4.0, what
is the malloc really doing:

- is it getting a chunk of memory which is LOCK every time you call malloc, and
  as a result you might end up with a swiss cheese memory after a bunch of
  malloc and free,

- the application reserves a very big chunk of memory at the beginning, it is
  LOCKED, but as you malloc and free inside this big block, Think C is able to
  recompact the memory in the block itself.(if it is this solution, is there
  any way to specify the size of this block, grow it?)

- is it getting a standard handle, and making some kind of translations for
  every memory references, (this cannot be the solution, can it?)

- none of the above, 

My concern is really to figure out if writing a big application using the
toolbox and using the ANSI C library and malloc is doomed to failure because of
memory management problems.

Thanks in advance for enlighting me,
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Francois Felix INGRAND                          SRI International, AIC
felix@AI.SRI.COM                                333, Ravenswood Avenue
(415) 859-5584                                  MENLO PARK, CA 94025, USA
"Read my Lisp... No new syntax" (nil)