GObject Refcount Debugger

Welcome to the RefDbg web page.

What is it?

RefDbg is a GObject reference count debugger. GObject is part of the glib library (not to be confused with glibc) which forms the basis of GTK+ (the Gimp ToolKit), Gnome, GStreamer and many other projects. The GObject library adds object oriented stuff to C which by itself lacks object oriented features. Since C lacks garbage collection, a reference counting system is used. Each object has a count of how many other references (pointers) there are to it. Reference count bugs can be very hard to track down and can lead to crashes and memory leaks. Refdbg is a tool that can be used interactively with GDB to log, display and break on reference count activity, thereby making this task easier.


2006 Aug 7: Released RefDbg 1.2. Changes in this release: vastly improved backtraces with source and line numbers (using libbfd), alive object dump to end of log file on exit, object displays are sorted by GType name, performance and memory optimizations, other changes to interactive commands (see README for details). This may be the friendliest release of RefDbg yet! Thanks to Stefan Kost for testing and feature suggestions.

2005 Feb 5: Released RefDbg 1.1. Changes include: Information on using refdbg with glib-2.6.x, improved refcount timer expiration, negative offsets for event display to display from end of log, bug fixes including one that caused false positive refcount errors and documentation updates. Not thoroughly tested, so feedback would be much appreciated.

2005 Jan 24: Thanks go to Jean-François RAMEAU for pointing out that refdbg does not work with stock glib-2.6.x. A work around for this is to build glib yourself and pass the configure script "--disable-visibility". Additional thanks go to David Necas and Matthias Clasen on the gtk-list for confirming this problem and providing information on the build time option. I'll add more information in regards to this issue in the README of the next release.

2004 May 7: Released RefDbg 1.0. Features include: a nice interactive readline enabled shell; flexible criteria for displaying, setting break points, and logging refcount activity; display of active/destroyed objects and their current refcounts; a refcount timer to track object refcount changes over time (very useful for tracking down refcount leaks, postive or negative); stack back traces (although this could still be improved, see TODO items below).

More information

can be found in the README.
Check out the screen shots of RefDbg in action! Yeah, so what if its just a console program, doesn't the RefDbg shell look nice running in my terminal? :)


You can download RefDbg from the SourceForge file download page.

SourceForge Project

Head on over to the RefDbg SourceForge page for CVS access, mailing list and other goodies. Feel free to join the mailing list and post any topics related to RefDbg or GObject reference counting in general.


RefDbg for the most part is fairly complete although there are likely some bugs and other improvements that can be made. Here is a list of them:

SourceForge Logo

Author: Josh Green
Remove the 'NOSPAM-' from the email address if you are not a spammer :)