wrong malloc return
Wietse Z. Venema
wietse at wzv.UUCP
Thu May 11 06:39:54 AEST 1989
In article <8262 at techunix.BITNET> ssreefc at 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 at eutrc3.uucp | Eindhoven University of Technology
work: wswietse at heitue5.bitnet | Mathematics and Computing Science
home: wietse at wzv.uucp | Eindhoven, The Netherlands
More information about the Comp.lang.c
mailing list