Mail Archives: djgpp/1997/12/31/17:31:46
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 -