1
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
5
<title>Debugging reference count problems</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
7
<link rel="start" href="index.html" title="GObject Reference Manual">
8
<link rel="up" href="pt03.html" title="Part V. Related Tools">
6
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
7
<link rel="home" href="index.html" title="GObject Reference Manual">
8
<link rel="up" href="pt03.html" title="Part V. Related Tools">
9
9
<link rel="prev" href="tools-ginspector.html" title="Graphical inspection of GObjects">
10
10
<link rel="next" href="tools-gtkdoc.html" title="Writing API docs">
11
<meta name="generator" content="GTK-Doc V1.9 (XML mode)">
11
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
13
13
<link rel="preface" href="pr01.html" title="Introduction">
14
<link rel="part" href="pt01.html" title="Part I. Concepts">
14
<link rel="part" href="pt01.html" title="Part I. Concepts">
15
15
<link rel="chapter" href="chapter-intro.html" title="Background">
16
16
<link rel="chapter" href="chapter-gtype.html" title="The GLib Dynamic Type System">
17
17
<link rel="chapter" href="chapter-gobject.html" title="The GObject base class">
18
18
<link rel="chapter" href="chapter-signal.html" title="The GObject messaging system">
19
19
<link rel="reference" href="rn01.html" title="API Reference">
20
20
<link rel="reference" href="rn02.html" title="Tools Reference">
21
<link rel="part" href="pt02.html" title="Part IV. Tutorial">
21
<link rel="part" href="pt02.html" title="Part IV. Tutorial">
22
22
<link rel="chapter" href="howto-gobject.html" title="How to define and implement a new GObject">
23
23
<link rel="chapter" href="howto-interface.html" title="How to define and implement interfaces">
24
24
<link rel="chapter" href="howto-signals.html" title="How to create and use signals">
25
<link rel="part" href="pt03.html" title="Part V. Related Tools">
25
<link rel="part" href="pt03.html" title="Part V. Related Tools">
26
<link rel="chapter" href="tools-vala.html" title="Vala">
26
27
<link rel="chapter" href="tools-gob.html" title="GObject builder">
27
28
<link rel="chapter" href="tools-ginspector.html" title="Graphical inspection of GObjects">
28
29
<link rel="chapter" href="tools-refdb.html" title="Debugging reference count problems">
36
37
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
37
38
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
38
39
<link rel="index" href="ix09.html" title="Index of new symbols in 2.14">
40
<link rel="index" href="ix10.html" title="Index of new symbols in 2.14">
40
42
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
41
43
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
53
55
a few memory management problems but also introduces new sources of bugs.
54
56
In large applications, finding the exact spot where the reference count
55
57
of an Object is not properly handled can be very difficult. Hopefully,
56
there exist a tool named <a class="ulink" href="http://refdbg.sf.net/" target="_top">refdbg/</a>
58
there exist a tool named <a class="ulink" href="http://refdbg.sf.net/" target="_top">refdbg</a>
57
59
which can be used to automate the task of tracking down the location
58
60
of invalid code with regard to reference counting. This application
59
61
intercepts the reference counting calls and tries to detect invalid behavior.
61
63
interested in and it can be used together with GDB.
64
<a class="indexterm" name="id3006722"></a>
65
67
Note that if GObject has been compiled with <code class="option">--enable-debug=yes</code>,
66
68
it exports a trap variable
69
71
static volatile GObject *g_trap_object_ref;
72
If set to a non-NULL value, <a class="link" href="gobject-The-Base-Object-Type.html#g-object-ref">g_object_ref</a>()
73
and <a class="link" href="gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a>() will be intercepted
74
If set to a non-NULL value, <a class="link" href="gobject-The-Base-Object-Type.html#g-object-ref" title="g_object_ref ()">g_object_ref</a>()
75
and <a class="link" href="gobject-The-Base-Object-Type.html#g-object-unref" title="g_object_unref ()">g_object_unref</a>() will be intercepted
74
76
when called with that value.
81
Generated by GTK-Doc V1.11</div>