Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!usc!wuarchive!udel!haven!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: malloc and stuff Message-ID: <14576@smoke.brl.mil> Date: 26 Nov 90 21:36:20 GMT References: <25576@uflorida.cis.ufl.EDU> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 10 In article <25576@uflorida.cis.ufl.EDU> jdb@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.