Boost logo

Boost Users :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-08-26 11:16:35

"Daryle Walker" <darylew_at_[hidden]> wrote in message
> On 8/23/04 8:33 PM, "David Abrahams" <dave_at_[hidden]>
> > "Mark Storer" <MStorer_at_[hidden]> writes:
> >
> >>> No it is not. Even if you aren't throwing due to memory
> >>> you could run out of memory during unwinding, when the exception
> >>> copied. That leads you directly to terminate(). Do not pass
Go; do
> >>> not collect $200.
> >>
> >> Venturing a little far afield, but one technique I've heard of is
> >> grab a block, so you can release it in low-memory situations (or
> >> every time you throw).


> >> Either way, you'll run out of memory a little earlier (not a big
> >> in many environments), but you _will_ get to pocket the $200.
> >
> > Maybe. You can still exhaust your pre-allocated buffer. There's
> > need to play with fire here; it doesn't buy you much and it's easy
> > avoid.
> The pre-allocated buffer via a custom allocator won't help. The
> exception classes take standard strings as constructor arguments.
You can't
> change the memory policy for those classes, so you may end up with
> out-of-memory second exception if the standard memory pool fails.

I guess you mean the exceptions from <stdexcept>. Here you're at the
mecry of the library implementation. You still derive from
std::exception and use whatever memory management policy you want.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at