Details
Description
As of libcouchbase 2.7.4 (perhaps started in an earlier version > 2.7.0), there is memory allocated by lcb_create() which is not freed upon lcb_destroy().
The exact same application code did not show the leak on libcouchbase 2.4.7 and 2.7.0. It does on 2.7.4 and latest git master.
It can be triggered by the example/libeventdirect/main.c example, after correcting the destruction of the connection:
— main.c.org 2017-05-18 14:57:53.111670506 +0200
+++ main.c 2017-05-18 14:46:30.682121741 +0200
@@ -143,7 +143,8 @@
event_base_loop(evbase, 0);/* Cleanup */
- event_base_free(evbase);
lcb_destroy(instance);
+ lcb_destroy_io_ops(ioops);
+ event_base_free(evbase);
exit(EXIT_SUCCESS);
}
Valgrind output:
==1842== 80 bytes in 1 blocks are definitely lost in loss record 2 of 2
==1842== at 0x4A095A5: operator new(unsigned long) (vg_replace_malloc.c:333)
==1842== by 0x4C55BF1: lcb_create (instance.cc:426)
==1842== by 0x400FDE: create_libcouchbase_handle (in /home/rgr/src/couchbase/libcouchbase/example/libeventdirect/main)
==1842== by 0x4010E8: main (in /home/rgr/src/couchbase/libcouchbase/example/libeventdirect/main)