After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 98659 - valgrind reports error with gtk-demo
valgrind reports error with gtk-demo
Status: RESOLVED NOTABUG
Product: gtkmm
Classification: Bindings
Component: general
2.0
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2002-11-16 00:33 UTC by Murray Cumming
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Murray Cumming 2002-11-16 00:33:21 UTC
I don't get this error with any of the examples. This is just when starting
the application - there are more errors when quiting. This is on RH7.3 with
GNOME HEAD from cvs.

[root@localhost gtk-demo]# pwd
/gnome/head/cvs/c++/gtkmm2/demos/gtk-demo
[root@localhost gtk-demo]# valgrind --num-callers=20 .libs/lt-demo
==5467== valgrind-1.0.4, a memory error detector for x86 GNU/Linux.
==5467== Copyright (C) 2000-2002, and GNU GPL'd, by Julian Seward.
==5467== Estimated CPU clock rate is 931 MHz
==5467== For more details, rerun with: -v
==5467==
==5467== Mismatched free() / delete / delete []
==5467==    at 0x400449B9: __builtin_delete (vg_clientfuncs.c:194)
==5467==    by 0x8061C2C: ???
(/gnome/head/INSTALL/include/sigc++-1.2/sigc++/slot.h:219)
==5467==    by 0x407BFAB6: g_value_unset (gvalue.c:152)
==5467==    by 0x4026E62C: Glib::ValueBase::~ValueBase(void) (value.cc:59)
==5467==    by 0x80617C0: ??? (../../gtk/gtkmm/treemodelcolumn.h:99)
==5467==    by 0x805F3D4: DemoWindow::fill_tree(void)
(../../gtk/gtkmm/treeiter.h:283)
==5467==    by 0x805ED51: DemoWindow::DemoWindow(int) (demowindow.cc:81)
==5467==    by 0x80624CC: main (main.cc:31)
==5467==    by 0x408CD1C4: __libc_start_main (in /lib/libc-2.2.5.so)
==5467==    by 0x805E8C1: (within
/gnome/head/cvs/c++/gtkmm2/demos/gtk-demo/.libs/lt-demo)
==5467==    Address 0x42062D30 is 0 bytes inside a block of size 4 alloc'd
==5467==    at 0x40044644: malloc (vg_clientfuncs.c:100)
==5467==    by 0x808511D: (within
/gnome/head/cvs/c++/gtkmm2/demos/gtk-demo/.libs/lt-demo)
==5467==    by 0x8061BC7: ??? (../../glib/glibmm/value_custom.h:264)
==5467==    by 0x407BF802: g_value_init (gvalue.c:81)
==5467==    by 0x4026E58B: Glib::ValueBase::init(unsigned long) (value.cc:39)
==5467==    by 0x806179A: ??? (../../glib/glibmm/value_custom.h:232)
==5467==    by 0x805F3D4: DemoWindow::fill_tree(void)
(../../gtk/gtkmm/treeiter.h:283)
==5467==    by 0x805ED51: DemoWindow::DemoWindow(int) (demowindow.cc:81)
==5467==    by 0x80624CC: main (main.cc:31)
==5467==    by 0x408CD1C4: __libc_start_main (in /lib/libc-2.2.5.so)
==5467==    by 0x805E8C1: (within
/gnome/head/cvs/c++/gtkmm2/demos/gtk-demo/.libs/lt-demo)
Comment 1 Daniel Elstner 2002-11-16 01:23:01 UTC
I'm quite sure this is a bug in valgrind.  The following simple
program triggers the error:

#include <new>

int main(int, char**)
{
  int* foo = new(std::nothrow) int();
  delete foo;

  return 0;
}

It works fine when replacing new(std::nothrow) with the normal new.
Comment 2 Daniel Elstner 2002-11-16 01:42:30 UTC
I just had a look at the libstdc++-v3 headers and found this:

void operator delete(void *, const std::nothrow_t&) throw();

So the std::nothrow overload does exist for delete as well -- but the
compiler (g++ 3.2.1 here) doesn't accept it for some reason.  Well
it's quite useless anyway since it has the same empty throw()
signature as the normal delete.

Since the nothrow variants of new/delete use the same memory
allocation pool as the throwing ones there is no reason to disallow
mixing them.  Therefore I would still regard this as a valgrind bug.
Comment 3 Murray Cumming 2002-11-16 10:20:39 UTC
I sent an email to the valgrind maintainer about this. Thanks.