Skip to content

Commit 14018fa

Browse files
committed
README: Add note about valgrind support
1 parent daf340c commit 14018fa

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.org

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,24 @@ This library consists of only 5 functions:
9595
Free a fixed-size chunk from the specified pool. Allows =NULL= as both =pool= and
9696
=ptr= arguments.
9797

98+
* Valgrind support
99+
100+
This library supports the [[https://valgrind.org/][valgrind]] API, unless it has been compiled with the
101+
=LIBPOOL_NO_VALGRIND= macro defined. This allows the programmer to check for
102+
memory leaks and invalid memory accesses in his program (among other things)
103+
with the =valgrind= tool, just like it would with a program that uses =malloc=. Note
104+
that the valgrind macros don't affect the behavior of the program when it's not
105+
running under valgrind.
106+
107+
For example, after compiling the test program with valgrind disabled
108+
(i.e. =LIBPOOL_NO_VALGRIND= defined), if we run =valgrind ./libpool-test.out= we
109+
will see 9 allocations, corresponding to the =malloc= calls. However, if we enable
110+
valgrind support, we will see 111 allocations because it also checked the calls
111+
to =pool_alloc= and =pool_free=.
112+
113+
You might need to install some =valgrind-devel= package in your system in order to
114+
include the necessary headers.
115+
98116
* Building the example
99117

100118
Clone the repository and build the project using =make=.

0 commit comments

Comments
 (0)