[Pkg-javascript-commits] [node-leveldown] 398/492: memory leaks (missing scopes and whatnot)
Andrew Kelley
andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:14:23 UTC 2014
This is an automated email from the git hooks/post-receive script.
andrewrk-guest pushed a commit to annotated tag rocksdb-0.10.1
in repository node-leveldown.
commit 810bba4f6a475736003fec02b607c71b8f945847
Author: Rod Vagg <rod at vagg.org>
Date: Sun Sep 1 23:02:07 2013 +1000
memory leaks (missing scopes and whatnot)
---
src/database_async.cc | 20 +++++++++++++++++++-
test/leak-tester.js | 4 +++-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/database_async.cc b/src/database_async.cc
index 9f4c47d..5d19398 100644
--- a/src/database_async.cc
+++ b/src/database_async.cc
@@ -65,8 +65,8 @@ void CloseWorker::Execute () {
void CloseWorker::WorkComplete () {
NanScope();
-
HandleOKCallback();
+ AsyncWorker::WorkComplete();
}
/** IO WORKER (abstract) **/
@@ -79,12 +79,16 @@ IOWorker::IOWorker (
) : AsyncWorker(database, callback)
, key(key)
{
+ NanScope();
+
SavePersistent("key", keyHandle);
};
IOWorker::~IOWorker () {}
void IOWorker::WorkComplete () {
+ NanScope();
+
DisposeStringOrBufferFromSlice(GetFromPersistent("key"), key);
AsyncWorker::WorkComplete();
}
@@ -101,6 +105,8 @@ ReadWorker::ReadWorker (
) : IOWorker(database, callback, key, keyHandle)
, asBuffer(asBuffer)
{
+ NanScope();
+
options = new leveldb::ReadOptions();
options->fill_cache = fillCache;
SavePersistent("key", keyHandle);
@@ -140,6 +146,8 @@ DeleteWorker::DeleteWorker (
, v8::Local<v8::Object> &keyHandle
) : IOWorker(database, callback, key, keyHandle)
{
+ NanScope();
+
options = new leveldb::WriteOptions();
options->sync = sync;
SavePersistent("key", keyHandle);
@@ -166,6 +174,8 @@ WriteWorker::WriteWorker (
) : DeleteWorker(database, callback, key, sync, keyHandle)
, value(value)
{
+ NanScope();
+
SavePersistent("value", valueHandle);
};
@@ -173,11 +183,15 @@ WriteWorker::~WriteWorker () {}
void WriteWorker::Execute () {
SetStatus(database->PutToDatabase(options, key, value));
+ //printf("WriteWorker::Execute\n");fflush(stdout);
}
void WriteWorker::WorkComplete () {
+ NanScope();
+
DisposeStringOrBufferFromSlice(GetFromPersistent("value"), value);
IOWorker::WorkComplete();
+ //printf("WriteWorker::WorkComplete\n");fflush(stdout);
}
/** BATCH WORKER **/
@@ -217,6 +231,8 @@ ApproximateSizeWorker::ApproximateSizeWorker (
) : AsyncWorker(database, callback)
, range(start, end)
{
+ NanScope();
+
SavePersistent("start", startHandle);
SavePersistent("end", endHandle);
};
@@ -228,6 +244,8 @@ void ApproximateSizeWorker::Execute () {
}
void ApproximateSizeWorker::WorkComplete() {
+ NanScope();
+
DisposeStringOrBufferFromSlice(GetFromPersistent("start"), range.start);
DisposeStringOrBufferFromSlice(GetFromPersistent("end"), range.limit);
AsyncWorker::WorkComplete();
diff --git a/test/leak-tester.js b/test/leak-tester.js
index 43cf4c2..8972797 100644
--- a/test/leak-tester.js
+++ b/test/leak-tester.js
@@ -28,7 +28,8 @@ function run () {
process.nextTick(run)
})
- if (getCount % 1000 === 0)
+ if (getCount % 1000 === 0) {
+ gc()
console.log(
'getCount ='
, getCount
@@ -41,6 +42,7 @@ function run () {
return db.getProperty('leveldb.num-files-at-level' + l)
}))
)
+ }
}
leveldown.destroy('./leakydb', function () {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-leveldown.git
More information about the Pkg-javascript-commits
mailing list