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

Re: C++ exception handling question



Paul E Condon <pecondon@mesanetworks.net> writes:

> 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.

One thing you might not be aware of is that Linux overcommit the
memory.  That is, even if there is no memory left, it might tell the
program that it has enough, since it expect that by the time you use the
memory, it will be available. It's controlled by
/proc/sys/vm/overcommit_memory. 

Check the man page for malloc (look under BUGS), and do some search in
your favorite search engine.

-- 
John L. Fjellstad
web: http://www.fjellstad.org/          Quis custodiet ipsos custodes



Reply to: