Uploaded image for project: 'Couchbase Python Client Library'
  1. Couchbase Python Client Library
  2. PYCBC-394

Prior value never cleared when using Item API

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • Major
    • 2.2.4
    • None
    • library
    • None

    Description

      The prior item is never cleared when using the Item API, causing a memory leak unless the previous value is first cleared.

      Code:

      from couchbase.bucket import Bucket
      from couchbase.items import Item, ItemOptionDict
      import objgraph
       
      cb = Bucket('couchbase://localhost/default?select_bucket=true', username='default', password='123456')
      docKey = "testDocument"
      val = {
          "foo": "bar",
          "somearray": [],
      }
       
      cb.upsert(docKey, val)
       
      print
      print "Leaking code"
      print "count of objects in memory before - dicts:{}, lists:{}".format(
          objgraph.count('dict'), objgraph.count('list'))
      item = Item(key=docKey)
      for x in range(0, 10000):
          cb.get_multi(item.as_itcoll())
       
      print "count of objects in memory after - dicts:{}, lists:{}\n".format(
          objgraph.count('dict'), objgraph.count('list'))
      

      Attachments

        Activity

          People

            mnunberg Mark Nunberg (Inactive)
            mnunberg Mark Nunberg (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty