delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/05/04/18:15:08

Message-ID: <3AF329A4.1B8469DE@jps.net>
From: Dennis Yelle <dennis51 AT jps DOT net>
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: new doesn't throw an exception
Lines: 57
Date: Fri, 04 May 2001 15:13:57 -0700
NNTP-Posting-Host: 216.119.25.223
X-Complaints-To: abuse AT onemain DOT com
X-Trace: nntp1.onemain.com 989014238 216.119.25.223 (Fri, 04 May 2001 18:10:38 EDT)
NNTP-Posting-Date: Fri, 04 May 2001 18:10:38 EDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

When I compile and run this program:
====================================
#include <memory>
#include <iostream>

int main()
{
  cout << "testing new long.\n";
  int count = 0;
  for(;;) {
    long* p;
    try {
      //p = new(nothrow) long;
      p = new long;
    } catch (...) {
      return 99;
    }
    if ( !p )
      return 88;
    count++;
    if ( 0 == count % 200000)
      cout << "I got " << count << " longs.\n";
  }
  cout << "I got " << count << " longs.\n";
}
====================================
I get a stack dump, and when I symify it, I get:

Call frame traceback EIPs:
  0x00013454 ___djgpp_traceback_exit+48
  0x00013536 _raise+94
  0x000128bb _abort+27
  0x0000d7eb ___default_terminate+11, line 0 of libgcc2.c
  0x0000e27d _terminate__Fv+13, line 0 of exception.cc
  0x0000e32a ___eh_alloc+30, line 0 of exception.cc
  0x0000d72d ___builtin_new+65, line 0 of new1.cc
  0x000015ca _main+42
  0x00010992 ___crt1_startup+178

When new fails, it is supposed to throw an exception that
can be caught with
  catch(...)
But it does not do so.
Symify leads me to think that the problem is in new1.cc
I am trying to find the file new1.cc
It is NOT in DJLSR203.ZIP and it is not in GCC2953B.ZIP
Can anyone tell me where to find the source file new1.cc ?

Also, it looks like new long usually allocates 24 bytes
per requested long.  This seems excessive to me.
Does anyone know why it should do this?

Dennis Yelle
-- 
I am a computer programmer and I am looking for a job.
There is a link to my resume here:  
http://table.jps.net/~vert/

- Raw text -


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