Skip to content

Commit d7ec7f2

Browse files
committed
Add information in the README about the test LEAK_CHECK functionality
1 parent e0634e7 commit d7ec7f2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ $ cargo test --features=enterprise
8282

8383
### Run with Couchbase Lite C leak check
8484

85+
Couchbase Lite C allows checking if instances of their objects are still alive through the functions `CBL_InstanceCount` & `CBL_DumpInstances`.
86+
If the `LEAK_CHECK` environment variable is set, we check that the number of instances at the end of each test is 0.
87+
88+
If this step fails in one of your pull requests, you should look into the `wrap`/`retain` logic on CBL pointers in the constructor of the Rust structs:
89+
- `wrap` takes ownership of the pointer, it will not increase the ref count of the `ref` CBL pointer so releasing it (in a `drop`) will destroy the pointer
90+
- `retain` just references the pointer, it will increase the ref count of CBL pointers so releasing it will not destroy the pointer
91+
8592
```shell
8693
$ LEAK_CHECK=y cargo test --features=enterprise -- --test-threads 1
8794
```

0 commit comments

Comments
 (0)