malloc and stuff

Doug Gwyn gwyn at smoke.brl.mil
Tue Nov 27 08:36:20 AEST 1990


In article <25576 at uflorida.cis.ufl.EDU> jdb at reef.cis.ufl.edu (Brian W.K. Hook) writes:
>Or would it just say that you can't allocate that 100K block
>at all since it isn't contiguous?

Correct.  malloc() allocates a single contiguous chunk of memory.
It cannot create one by moving earlier active allocations, because
the application holds pointers that wouldn't work after the move.
Thus, if not enough contiguous storage is already available, and
if there is no way to acquire more from the system (as via UNIX
sbrk()), malloc() simply reports failure.



More information about the Comp.lang.c mailing list