www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/09/26/21:19:03

From: "A. Sinan Unur" <asu1 AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: That's my problem - can't use large memory!
Date: 27 Sep 2001 01:08:47 GMT
Organization: Cornell University
Lines: 25
Sender: asu1 AT cornell DOT invalid (on slip-32-102-40-71.ny.us.prserv.net)
Message-ID: <Xns9128D71C5DFCDASINANUNUR@132.236.56.8>
References: <20010926232900 DOT 60493 DOT qmail AT web14606 DOT mail DOT yahoo DOT com>
NNTP-Posting-Host: slip-32-102-40-71.ny.us.prserv.net
X-Trace: news01.cit.cornell.edu 1001552927 28655 32.102.40.71 (27 Sep 2001 01:08:47 GMT)
X-Complaints-To: usenet AT news01 DOT cit DOT cornell DOT edu
NNTP-Posting-Date: 27 Sep 2001 01:08:47 GMT
User-Agent: Xnews/4.06.22
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

bos <ivan_bos_1999 AT yahoo DOT com> wrote in
news:20010926232900 DOT 60493 DOT qmail AT web14606 DOT mail DOT yahoo DOT com: 

> My source:
> 
> #include <iostream.h>
> void main()

main returns int ... don't you get a warning when compiled with -Wall?

> {
>  int c[10000000000];
> }

please read the faq entry that DJ posted. you are allocating c on the stack 
and there is just not enough room on the stack to hold 38146.97 MB. in 
fact, i don't think you can allocate that much memory on the heap either :)

instead use new or malloc to allocate 10,000,000 integers or something.

sinan.
-- 
--------------------------------
A. Sinan Unur
http://www.unur.com/

- Raw text -


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