delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/07/17/03:22:46

From: jkolen AT typhoon DOT coginst DOT uwf DOT edu (John F. Kolen)
Subject: new and exceptions
17 Jul 1998 03:22:46 -0700 :
Message-ID: <9807161350.ZM29864.cygnus.gnu-win32@typhoon.coginst.uwf.edu>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

I am using egcs 1.0.2 under cygwin32.  In g++, does new throw a bad_alloc
exception if the underlying alloc fails.  The following code should eventually
generate such an exception (if iterated enough times).

try {
  int * x = new int[50000000];
}
catch (bad_alloc a)
{
  cout << "bad_alloc caught";
  abort(1);
}

Instead of generating the "caught" message, we get the following error
message

(EXECUTABLE_NAME) commit_and_ind: VirtualAlloc failed
Virtual memory exceded in `new'

An earlier test of exceptions (explicitly throwing one) worked fine.
Any help would be appreciated.

-- 
John F. Kolen				voice: (850)474-3075 
Assistant Professor			fax:   (850)474-3023
Dept. of Computer Science
University of West Florida
Pensacola, FL 32514
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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