[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to test memory allocation with new ?
From: |
Sharad Kala |
Subject: |
Re: How to test memory allocation with new ? |
Date: |
Mon, 1 Nov 2004 19:17:13 +0530 |
"jjleto" <jjleto@laposte.net> wrote in message
> > char *pp = new char[...];
>
> Thanks, the segmentation fault was actually for the reason you gave.
>
> Nevertheless, I still have an error when running this program ("give up"
> but not a segfault)
>
> How do I test memory allocation with new ?
I told you in my earlier reply too that new throws std::bad_alloc on
exception. You need to wrap the new in a try-catch block (catching
std::bad_alloc).
Sharad
Re: How to test memory allocation with new ?, Cosmin Calinescu, 2004/11/01
Re: How to test memory allocation with new ?, Larry I Smith, 2004/11/01