1
<?xml version="1.0"?> <!-- -*- sgml -*- -->
2
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5
<chapter id="o-manual" xreflabel="Omega">
7
<title>Omega: an instant memory leak detector</title>
9
<para>Omega is a Valgrind tool that traces pointers to memory
10
allocations and produces debug output as the last reference
11
is removed to a block that has not been de-allocated.</para>
13
<para>Omega works by tracking pointers with the use of p-bits.
14
In similar fashion to the methods used by memcheck and
15
addrcheck, each memory location is flagged by a p-bit which
16
indicates if the location is holding a pointer to an allocated
17
block. Since pointers are multibyte, we gain by only requiring
18
a single p-bit per pointer thus needing one p-bit per 4 bytes
19
on 32bit machines and one p-bit per 8 bytes on 64bit
22
<para>Whilst this simplifies and reduces the memory footprint of
23
one aspect of the tracking methodology, the other aspect can be
24
a bit of a memory hog. As each block is allocated, we need to
25
maintain data about the block and hold back-references to any
26
live pointers. There are various ways of doing this and as the
27
tool evolves further upon its release, doubtless you will all
28
improve upon it (and that's why I love open source).</para>
30
<para>This tool has been checked against the simple test cases in
31
the tests directory. Again, you will all have many more that
34
<para>Note that in order to reduce the overheads that this tool
35
incurs, it is assumed that the only problems left are memory
36
leaks. This assumption allows many corner cases to be left
37
un-coded. As we stumble upon those that cannot be avoided,
38
they can be added. A major assumption in the tracking is
39
that all pointers are aligned in memory. If this one fails,
40
the tracking code will have to be re-jigged.</para>
42
<para>Bryan "Brain Murders" Meredith, 2006</para>