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'))
|