Description
Excerpt from https://github.com/couchbase/couchbase-lite-core/issues/1221
Valgrind is showing me a leak for the FLEncoder used in getIndexexInfo:
{{==191397== 13,056 (288 direct, 12,768 indirect) bytes in 4 blocks are definitely lost in loss record 251 of 252
==191397== at 0x4A3A99F: operator new[](unsigned long) (vg_replace_malloc.c:579)
==191397== by 0x621B08E: FLEncoder_NewWithOptions (Fleece.cc:540)
==191397== by 0x621B069: FLEncoder_New (Fleece.cc:534)
==191397== by 0x60A00BD: litecore::CollectionImpl::getIndexesInfo(bool) const (CollectionImpl.hh:486)
==191397== by 0x60729EC: C4Database::getIndexesInfo(bool) const (c4Database.cc:215)
==191397== by 0x5FF13C5: CBLDatabase::indexNames() (CBLDatabase_Internal.hh:210)
==191397== by 0x5FEF041: CBLDatabase_GetIndexNames (CBLDatabase_CAPI.cc:329)
==191397== by 0x541C488: ???
==191397== by 0x541C42B: ???
==191397== by 0x542B3F0: ???
==191397== by 0x542B432: ???
==191397== by 0x5430791: ???}}
It looks like the encoder is never freed with FLEncoder_Free.
The result of getIndexexInfo is also reported as being leaked:
{{==191397== 128 bytes in 4 blocks are definitely lost in loss record 229 of 252
==191397== at 0x4A38FB5: malloc (vg_replace_malloc.c:380)
==191397== by 0x622024F: fleece::sharedBuffer::operator new(unsigned long, unsigned long) (FLSlice.cc:127)
==191397== by 0x6220087: FLSliceResult_New (FLSlice.cc:161)
==191397== by 0x5FF90B9: fleece::alloc_slice::alloc_slice(unsigned long) (slice.hh:797)
==191397== by 0x62700DE: fleece::Writer::copyOutput() const (Writer.cc:237)
==191397== by 0x627019C: fleece::Writer::finish() (Writer.cc:248)
==191397== by 0x62297A9: fleece::impl::Encoder::finish() (Encoder.cc:149)
==191397== by 0x621C863: FLEncoder_Finish (Fleece.cc:702)
==191397== by 0x60A03B5: litecore::CollectionImpl::getIndexesInfo(bool) const (CollectionImpl.hh:510)
==191397== by 0x60729EC: C4Database::getIndexesInfo(bool) const (c4Database.cc:215)
==191397== by 0x5FF13C5: CBLDatabase::indexNames() (CBLDatabase_Internal.hh:210)
==191397== by 0x5FEF041: CBLDatabase_GetIndexNames (CBLDatabase_CAPI.cc:329)}}
{{}}
------------------------------
I think the second problem has been fixed in fleece
a4a2d9e14b9a15b63370886b75e29f24c8fd9b4f
{{}}
Attachments
Issue Links
- relates to
-
CBL-2391 Lithium backports
- Closed