Re: throwing out of memory exception in c++ doesnt work
From: Leor Zolman (leor_at_bdsoft.com)
Date: 03/01/04
- Next message: Chris: "unpacking ints"
- Previous message: Christian Lynbech: "Re: off-topic: Why is lisp so weird?"
- In reply to: Stephan: "Re: throwing out of memory exception in c++ doesnt work"
- Next in thread: Pete Becker: "Re: throwing out of memory exception in c++ doesnt work"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 01 Mar 2004 13:24:47 GMT
On Mon, 01 Mar 2004 06:08:18 GMT, Stephan
<stephas@frogking.stephas.homelinux.org> wrote:
>On Mon, 01 Mar 2004 05:41:20 +0000, Leor Zolman wrote:
>> If you're not allocating much memory and your program crashes, I doubt the
>> crash is related to exhaustion of the free store! Pointer bug? Have a
>> debugger you can fire up and trace through the program with? Why do you
>> think the issue is dynamic-memory-allocation-failure related?
>
>gdb just tells me:
>Program terminated with signal SIGKILL, Killed.
>I didnt kill it and gdb doesnt report a line number, and gtkrellm shows
>that my memory is filling up until the SIGKILL interrupts.
Good, intuitive debuggers can be hard to find on Unix...but there's always
good 'ole cerr. As a last resort I begin putting in trace statements. There
are some great tricks for doing that sort of thing in the Eckel/Allison
book I cited. You need a better handle on where the code is when it
crashes.
>I am pretty familiar with the above, and I meant the actual exception data
>type you wrote here:
>> catch (const exception &e)
>I think this is the type for any OS thrown exceptions, since you can throw
>your own int, char, whatever ones. I guess I answered my own question.
Yeah, basically all standard exceptions derive from "exception"; in this
case I did that to gain access to the what() member function. If I didn't
care about that, I would probably just have used catch(...)
-leor
>
>However I am still unsure about why I get a SIGKILL ! If I leave your try
>and catch block out and dont throw the bad_alloc(), I ll be stuck in an
>endless loop but I can't even see that more memory is used in gtkrellm,
>which shows how much memory is currently in use.
>thanks
>stephan
Leor Zolman
BD Software
leor@bdsoft.com
www.bdsoft.com -- On-Site Training in C/C++, Java, Perl & Unix
C++ users: Download BD Software's free STL Error Message
Decryptor at www.bdsoft.com/tools/stlfilt.html
- Next message: Chris: "unpacking ints"
- Previous message: Christian Lynbech: "Re: off-topic: Why is lisp so weird?"
- In reply to: Stephan: "Re: throwing out of memory exception in c++ doesnt work"
- Next in thread: Pete Becker: "Re: throwing out of memory exception in c++ doesnt work"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|