|
From: JAN S. <loi...@ya...> - 2003-07-17 10:34:56
Attachments:
foo.pid28337.gz
|
Hi there.
With the latest stable release and latest snapshot,
valgrind reports 2 "Mismatched free() / delete /
delete []":
//---------------
#include <new>
struct xx { xx (int i=7) : x(i) { } int x ; } ;
int main() {
xx* pxx = new (std::nothrow) xx[10] ;
delete [] pxx ;
char* pcc = new (std::nothrow) char[1024] ;
delete [] pcc ;
}
// ----------------
I have attached a verbose output of valgrind.
As far as I understand, the problem is not in VALGRIND
(which I love very much :-), but in libstdc++-v3, more
specifically new_opvnt.cc which says:
//----------------
void *
operator new[] (std::size_t sz, const std::nothrow_t&
nothrow) throw() {
return ::operator new(sz, nothrow)l
}
hence I don't see how valgrind could get it right.
I shall gladly investigate this if it hasn't been
already done (couln't find any traces).
Thank you!
J.
libstdc++-3.2.2-5
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
valgrind-20030716
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com |
|
From: Nicholas N. <nj...@ca...> - 2003-10-12 18:26:48
|
On Thu, 17 Jul 2003, JAN S. wrote:
> With the latest stable release and latest snapshot,
> valgrind reports 2 "Mismatched free() / delete /
> delete []":
>
> //---------------
> #include <new>
> struct xx { xx (int i=7) : x(i) { } int x ; } ;
> int main() {
> xx* pxx = new (std::nothrow) xx[10] ;
> delete [] pxx ;
> char* pcc = new (std::nothrow) char[1024] ;
> delete [] pcc ;
> }
> // ----------------
This has now been fixed in the CVS HEAD; Valgrind doesn't emit the
spurious error. Thanks for the report.
N
|