home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!decwrl!netcomsv!netcom.com!feustel
- From: feustel@netcom.com (David Feustel)
- Subject: Re: Allocating arrays larger than 64K with new?
- Message-ID: <f94m37_.feustel@netcom.com>
- Date: Wed, 12 Aug 92 23:34:17 GMT
- Organization: DAFCO: OS/2 Software Support & Consulting
- References: <1992Aug9.152253.11345@newshub.sdsu.edu> <894@nazgul.UUCP>
- Lines: 82
-
- The following program compiles and links successfully with the ZTC
- -mx option. Running the program crashes the system. The program was
- linked and run under Flashtek's x32 dos extender.
-
- ==============
-
- #include <stdio.h>
-
- #define AS 3000000
-
- long * getspace(unsigned int amount)
- { long * a;
- printf("malloc %d ",amount);
- if(a=(long *) malloc(sizeof(long)*amount))
- { printf("succeeded\n");
-
- else
-
- { printf("failed\n");
-
- }
-
- return a;
-
- }
-
-
-
-
-
- void main(int argc,char **argv)
-
- { long i,imax=AS;
-
- double sum=0;
-
- long *a, *b, *c;
-
- printf("Hello, World\n");
-
- for(i=0;i<argc;++i)
-
- { printf("%s\n",argv[i]);
-
- }
-
- a=getspace(AS);
-
- b=getspace(AS);
-
- c=getspace(AS);
-
- if (a==0|b==0|c==0) exit(-1);
-
- for(i=0;i<imax;++i)
-
- {
-
- a[i]=i*i;
-
- b[i]=i;
-
- c[i]=i*i*i;
-
- sum+=a[i]+b[i]+c[i];
-
- }
-
- free(a); free(b); free(c);
-
- printf("sum: %e\n",sum);
-
- exit(0);
-
- }
-
-
- --
- Dave Feustel N9MYI <feustel@netcom.com>
- ---
- Given Civil Seizure, from the DEA's point of view, winning the War on
- Drugs would be killing the Goose that lays golden eggs.
-