1BSON_VALGRIND(3) Libbson BSON_VALGRIND(3)
2
3
4
6 bson_valgrind - Use Valgrind to Check For BSON Data Leaks
7
8 A stack-allocated bson_t contains a small internal buffer; it only
9 heap-allocates additional storage if necessary, depending on its data
10 size. Therefore if you forget to call bson_destroy on a stack-allocated
11 bson_t, it might or might not cause a leak that can be detected by val‐
12 grind during testing.
13
14 To catch all potential BSON data leaks in your code, configure the
15 BSON_MEMCHECK flag:
16
17 cmake -DCMAKE_C_FLAGS="-DBSON_MEMCHECK -g" .
18
19 With this flag set, every bson_t mallocs at least one byte. Run your
20 program's unittests with valgrind to verify all bson_t structs are
21 destroyed.
22
23 Set the environment variable MONGOC_TEST_VALGRIND to on to skip tim‐
24 ing-dependent tests known to fail with valgrind.
25
27 MongoDB, Inc
28
30 2017-present, MongoDB, Inc
31
32
33
34
351.13.1 Jan 24, 2019 BSON_VALGRIND(3)