[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: C++ exception handling question



On Mon, Nov 06, 2006 at 10:04:15AM -0500, Michael Marsh wrote:
> On 11/5/06, Paul E Condon <pecondon@mesanetworks.net> wrote:
> >I've written a program in C++ using STL for some fairly
> >tricky simulation work. The program works, but fails
> >during initialization for some choices of input parameters.
> >I think the problem is not enough RAM, but I'd like to
> >confirm that, so I tried enclosing the relevant parts
> >of int main(...) in a try block to see what exceptions
> >I could catch. (I'm using Debian Sarge, and GNU C++ from
> >Debian repository.)
> 
> Since others have comment on the likely cause, I'll make a different
> suggestion: see if you get anything useful from the massif tool in
> valgrind.  It calls itself a "heap profiler," but it tracks stack
> usage, as well.  That should at least tell you if you're getting into
> the no-more-memory realm.
> 

Thanks for stack profiling info. I wonder if this _is_ a reportable
bug. After all, there is a lot of information on the 'bad_alloc'
exception in various sources. If GNU C++ library doesn't try to throw
this exception until it is too late for the throw to succeed, what
good is it? And, how was its operation verified during testing on a
Debain box? At the point where it kill happens, I think the program
is allocating space for the contents of large STL vector of vectors.
It doesn't seem to me that this should be done on the stack, but I
haven't thought deeply on the issue. 

Oh, well. It's now much much less of a mystery, and that is progress.
Thanks to all.
-- 
Paul E Condon           
pecondon@mesanetworks.net



Reply to: