Skip to content

Commit b3196a6

Browse files
committed
Add memleak check docs
Document how to run it locally on macOS & Linux
1 parent f4584a1 commit b3196a6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,29 @@ https://github.com/vmg/clar
2020
* Make sure everything is fine.
2121

2222
* Send your pull request. That's it.
23+
24+
25+
Memory leak checks
26+
------------------
27+
28+
These are automatically run as part of CI, but if you want to check locally:
29+
30+
#### Linux
31+
32+
Uses [`valgrind`](http://www.valgrind.org/):
33+
34+
```console
35+
$ cmake -DBUILD_CLAR=ON -DVALGRIND=ON ..
36+
$ cmake --build .
37+
$ valgrind --leak-check=full --show-reachable=yes --num-callers=50 --suppressions=../libgit2_clar.supp \
38+
./libgit2_clar
39+
```
40+
41+
#### macOS
42+
43+
Uses [`leaks`](https://developer.apple.com/library/archive/documentation/Performance/Conceptual/ManagingMemory/Articles/FindingLeaks.html), which requires XCode installed:
44+
45+
```console
46+
$ MallocStackLogging=1 MallocScribble=1 MallocLogFile=/dev/null CLAR_AT_EXIT="leaks -quiet \$PPID" \
47+
./libgit2_clar
48+
```

0 commit comments

Comments
 (0)