bad_alloc



Hello everyone,


Please help to comment whether my following understanding is correct,

1. whether or not we are using auto_ptr to allocate new object on heap
(using new), there may be bad_alloc exceptions;

2. when we met with such exceptions, we catch it (bad_alloc) and try to
mininize the operation in catch handler block (since when bad_alloc occurs,
it means memory is running out, we can not do anything complex in handler).

Both are correct? Please feel free to correct me if I am wrong.


thanks in advance,
George
.



Relevant Pages

  • Malloc, free and thread-safety
    ... I get intermittent exceptions such as: ... HEAP[recv.exe]: HEAP: Free Heap block 316d978 modified at 316d988 after it ... I've checked carefully that malloc() and freeare ... The exceptions are infrequent and intermittent for basically the same traces ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Allocatable Components of Derived Type
    ... One exception I guess is an allocatable array declared in a subroutine ... There are *NO* exceptions. ... Such a case will not cause a memory leak, ... If you try to allocate the array again without ...
    (comp.lang.fortran)
  • Re: Tuning JVM
    ... I think the lower bound of the heap size is set to 64M, ... Before you start tuning your JVM, I'd make sure you're not swallowing ... an exceptions that are getting thrown. ...
    (comp.lang.java)
  • Re: Handling Out Of Memory
    ... In this form all exceptions generated while the program is executing between ... Lists are nothing more than degenerate trees. ... is able to cope with an out of memory condition isn't ... >> allocate it. ...
    (alt.comp.lang.borland-delphi)
  • Re: Allocatable Components of Derived Type
    ... One exception I guess is an allocatable array declared in a subroutine ... Such a case will not cause a memory leak, ... If you try to allocate the array again without ... exceptions, I'd suggest turning in a defect report to the standard ...
    (comp.lang.fortran)