summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2019-06-13 11:38:14 +0200
committerGitHub <noreply@github.com>2019-06-13 11:38:14 +0200
commit758d1b9ceb81c3d3f4b011f8d6b1b40b94dbcb3a (patch)
treef3db09435562c3cc136561cdd4b8774ced675ddd
parentff7652c150c5a9cd2e93045c7fe791fbb2d2dbc7 (diff)
parentb3196a60c53463a492cf02332541fab8dc9ee504 (diff)
downloadlibgit2-758d1b9ceb81c3d3f4b011f8d6b1b40b94dbcb3a.tar.gz
Merge pull request #5104 from rcoup/patch-1
Add memleak check docs
-rw-r--r--tests/README.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/README.md b/tests/README.md
index 3aeaaf464..b1d70d3bc 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -20,3 +20,29 @@ https://github.com/vmg/clar
* Make sure everything is fine.
* Send your pull request. That's it.
+
+
+Memory leak checks
+------------------
+
+These are automatically run as part of CI, but if you want to check locally:
+
+#### Linux
+
+Uses [`valgrind`](http://www.valgrind.org/):
+
+```console
+$ cmake -DBUILD_CLAR=ON -DVALGRIND=ON ..
+$ cmake --build .
+$ valgrind --leak-check=full --show-reachable=yes --num-callers=50 --suppressions=../libgit2_clar.supp \
+ ./libgit2_clar
+```
+
+#### macOS
+
+Uses [`leaks`](https://developer.apple.com/library/archive/documentation/Performance/Conceptual/ManagingMemory/Articles/FindingLeaks.html), which requires XCode installed:
+
+```console
+$ MallocStackLogging=1 MallocScribble=1 MallocLogFile=/dev/null CLAR_AT_EXIT="leaks -quiet \$PPID" \
+ ./libgit2_clar
+```