delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/31/17:31:46

From: "Tony O'Bryan" <aho450s AT nic DOT smsu DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DJGPP and NT Alpha
Date: Wed, 31 Dec 1997 16:23:29 -0600
Organization: Southwest Missouri State University
Lines: 27
Message-ID: <34AAC5E1.1648@nic.smsu.edu>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 971231095120 DOT 3217L-100000 AT is> <68e6c5$53g AT crcnis3 DOT unl DOT edu>
Reply-To: aho450s AT nic DOT smsu DOT edu
NNTP-Posting-Host: marie.a39.smsu.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Jeffrey N Woodford wrote:
> 
> DPMI memory available: 13943 Kb
> DPMI swap space available: 0 Kb
> 
> Is my lack of swap space the reason why it won't run these "large" programs?
> 
> I tried this simple program and the pointer d returned NULL.  Is my
> program unreasonable?  Is there an example program or something that I
> could try to see if the compiler is working correctly?
> 
> #include <stdio.h>
> #include <stdlib.h>
> 
> int main (void)
> {
>    double *d;
> 
>    d = (double *) malloc (4000000 * sizeof (double));
>    if (d == NULL) printf ("d is null!\n");
>    else free(d);
>    return (0);
> }

You have approximately 13M of available DPMI memory and no swap space,
but you're trying to allocate about 32M of memory (4,000,000 * 8). 
That's why malloc is returning NULL.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019