delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/22/10:05:17

From: "Campbell, Rolf [SKY:1U32:EXCH]" <cp1v45 AT americasm01 DOT nt DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: memory
Date: Tue, 22 Jun 1999 09:25:35 -0400
Organization: Nortel Networks
Lines: 28
Message-ID: <376F8ECF.CD052125@americasm01.nt.com>
References: <7jk4cc$an5 AT fstgal00 DOT tu-graz DOT ac DOT at> <375DA526 DOT A3AC190C AT swipnet DOT se> <376922D9 DOT F2F95A8F AT americasm01 DOT nt DOT com> <376939FC DOT 2C38A228 AT swipnet DOT se>
NNTP-Posting-Host: bmerhc00.ca.nortel.com
Mime-Version: 1.0
X-Mailer: Mozilla 4.6 [en] (X11; I; HP-UX B.10.20 9000/712)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id KAB18108
Reply-To: djgpp AT delorie DOT com

Mattias Eklöf wrote:

> > > > how can I make an array with c++ in dos with 1Meg?
> > > char* pArray = new char[1024*1024];
> > > if (pArray == 0) cerr << "Oops...! Time to buy more memory!" << endl;
> >     Only problem is that (by default) new will terminate the program if
> > there isn't enough memory, not return null.
> I've never experienced that would be the case with DJGPP.
> Mattias

Try compiling and running this:

char* a = new char[1000000000];

int main()
{
  return 0;
}

I get "Virtual memory exceeded in `new'" as output.

--
     -Rolf Campbell (39)3-6318



- Raw text -


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