Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-2243

memory leak, couchbase-lite-core issue#1221

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.8.5
    • 3.0
    • LiteCore
    • Security Level: Public
    • None
    • Jianmin 54
    • 3

    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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            Build couchbase-lite-core-3.1.0-2 contains couchbase-lite-core commit 0ca2d90 with commit message:
            Fix a memory leak, CBL-2243 (#1237)

            build-team Couchbase Build Team added a comment - Build couchbase-lite-core-3.1.0-2 contains couchbase-lite-core commit 0ca2d90 with commit message: Fix a memory leak, CBL-2243 (#1237)

            Build couchbase-lite-cblite-3.0.0-157 contains couchbase-lite-core commit 0ca2d90 with commit message:
            Fix a memory leak, CBL-2243 (#1237)

            build-team Couchbase Build Team added a comment - Build couchbase-lite-cblite-3.0.0-157 contains couchbase-lite-core commit 0ca2d90 with commit message: Fix a memory leak, CBL-2243 (#1237)

            Build couchbase-lite-log-3.0.0-157 contains couchbase-lite-core commit 0ca2d90 with commit message:
            Fix a memory leak, CBL-2243 (#1237)

            build-team Couchbase Build Team added a comment - Build couchbase-lite-log-3.0.0-157 contains couchbase-lite-core commit 0ca2d90 with commit message: Fix a memory leak, CBL-2243 (#1237)

            Build couchbase-lite-ios-3.1.0-13 contains couchbase-lite-core commit 0ca2d90 with commit message:
            Fix a memory leak, CBL-2243 (#1237)

            build-team Couchbase Build Team added a comment - Build couchbase-lite-ios-3.1.0-13 contains couchbase-lite-core commit 0ca2d90 with commit message: Fix a memory leak, CBL-2243 (#1237)

            Build couchbase-lite-android-3.1.0-3 contains couchbase-lite-core commit 0ca2d90 with commit message:
            Fix a memory leak, CBL-2243 (#1237)

            build-team Couchbase Build Team added a comment - Build couchbase-lite-android-3.1.0-3 contains couchbase-lite-core commit 0ca2d90 with commit message: Fix a memory leak, CBL-2243 (#1237)

            Build couchbase-lite-java-3.1.0-3 contains couchbase-lite-core commit 0ca2d90 with commit message:
            Fix a memory leak, CBL-2243 (#1237)

            build-team Couchbase Build Team added a comment - Build couchbase-lite-java-3.1.0-3 contains couchbase-lite-core commit 0ca2d90 with commit message: Fix a memory leak, CBL-2243 (#1237)

            Build couchbase-lite-net-3.1.0-8 contains couchbase-lite-core commit 0ca2d90 with commit message:
            Fix a memory leak, CBL-2243 (#1237)

            build-team Couchbase Build Team added a comment - Build couchbase-lite-net-3.1.0-8 contains couchbase-lite-core commit 0ca2d90 with commit message: Fix a memory leak, CBL-2243 (#1237)

            Build couchbase-lite-c-3.1.0-34 contains couchbase-lite-core commit 0ca2d90 with commit message:
            Fix a memory leak, CBL-2243 (#1237)

            build-team Couchbase Build Team added a comment - Build couchbase-lite-c-3.1.0-34 contains couchbase-lite-core commit 0ca2d90 with commit message: Fix a memory leak, CBL-2243 (#1237)

            People

              jianmin.zhao Jianmin Zhao
              jianmin.zhao Jianmin Zhao
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty