MALLOC_TRACE(" = %p\n", v ); \
return v; \
}
-ALLOC( malloc, SK_(malloc) );
-ALLOC( __builtin_new, SK_(__builtin_new) );
-ALLOC( _Znwj, SK_(__builtin_new) );
-ALLOC( __builtin_vec_new, SK_(__builtin_vec_new) );
-ALLOC( _Znaj, SK_(__builtin_vec_new) );
+ALLOC( malloc, SK_(malloc) );
+ALLOC( __builtin_new, SK_(__builtin_new) );
+ALLOC( _Znwj, SK_(__builtin_new) );
+
+// operator new(unsigned, std::nothrow_t const&)
+ALLOC( _ZnwjRKSt9nothrow_t, SK_(__builtin_new) );
+
+ALLOC( __builtin_vec_new, SK_(__builtin_vec_new) );
+ALLOC( _Znaj, SK_(__builtin_vec_new) );
+
+// operator new[](unsigned, std::nothrow_t const&
+ALLOC( _ZnajRKSt9nothrow_t, SK_(__builtin_vec_new) );
#define FREE(fff, vgfff) \
void fff ( void* p ) \
--- /dev/null
+#include <new>
+
+// At one point, Valgrind wasn't overriding these 'nothrow' versions; since
+// they call malloc(), the calls to 'delete' caused bogus mismatch errors.
+
+int main()
+{
+ int * a = new (std::nothrow) int;
+ int * b = new (std::nothrow) int[5];
+ delete a;
+ delete [] b;
+}
+