Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!sun-barr!texsun!pitstop!sundc!seismo!uunet!mcvax!hp4nl!eutrc3!wzv!wietse From: wietse@wzv.UUCP (Wietse Z. Venema) Newsgroups: comp.lang.c Subject: Re: wrong malloc return Keywords: TurboC Message-ID: <294@wzv.UUCP> Date: 10 May 89 20:39:54 GMT References: <8262@techunix.BITNET> Reply-To: wietse@wzv.UUCP (Wietse Z. Venema) Organization: Eindhoven University of Technology, The Netherlands Lines: 15 In article <8262@techunix.BITNET> ssreefc@techunix.BITNET (florin coter) writes: > > if( ( p = (char *)malloc( many mega bytes... ) ) == NULL ) > puts( "no space..." ); > >[on an ibm with 640 Kb of ram with turboC 1.5] i never get the "no space..." >line on the screen. why ? malloc() expects an unsigned integer argument. Therefore, on a 16-bit machine it allocates at most 65535 bytes per call. In your case, the argument as seen by malloc was 16 bits of gargabe. -- work: wswietse@eutrc3.uucp | Eindhoven University of Technology work: wswietse@heitue5.bitnet | Mathematics and Computing Science home: wietse@wzv.uucp | Eindhoven, The Netherlands