guangyu-ryan / py-leveldb

Other
0 stars 0 forks source link

Memory leak when using WriteBatch #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the script attached to this report (WARNING: It will exhaust the 
available memory when run for long enough)

What is the expected output? What do you see instead?
I expect memory usage to rise to a certain level and stay at that level.

Instead memory usage keeps rising, even after syncing the WriteBatch to disk, 
and subsequently deleting the WriteBatch object.

What version of the product are you using? On what operating system?
Version 0.19 from here: https://pypi.python.org/pypi/leveldb
On Ubuntu Raring amd64

Please provide any additional information below.

Original issue reported on code.google.com by runesv...@gmail.com on 28 Aug 2013 at 8:11

Attachments:

GoogleCodeExporter commented 9 years ago
After looking at this, I'm unable to find a memory leak.

The testing program seems to be triggering the ever increasing memory usage.

The outer loop is fetching previously written values, appending a random value 
(variable random_val), writing that to the current batch, and at certain 
intervals, writing the batch to the DB, and clearing the batch.

Problem is that the values in the current batch just keep growing.

Replacing the Put() operation with something like "batch.Put(key, (prev_val + 
random_val)[:VALLEN])", seems to eliminate the issue.

Original comment by arnim...@gmail.com on 16 Sep 2013 at 4:12