From 33ccd392c94f9b86dd6724234958578a81902c4b Mon Sep 17 00:00:00 2001 From: Saikat Chakrabarti Date: Fri, 7 May 2010 14:29:36 -0700 Subject: [PATCH] Making decompress mem test last longer + plugging memory leaks in compress.cc --- compress.cc | 2 ++ test/decompress_memory_test.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/compress.cc b/compress.cc index 5a72f33..a75d606 100644 --- a/compress.cc +++ b/compress.cc @@ -164,6 +164,7 @@ class Gzip : public EventEmitter { } Local outString = Encode(out, out_size, BINARY); + free(buf); free(out); return scope.Close(outString); } @@ -339,6 +340,7 @@ class Gunzip : public EventEmitter { int r = gunzip->GunzipInflate(buf, len, &out, &out_size); Local outString = Encode(out, out_size, enc); + free(buf); free(out); return scope.Close(outString); } diff --git a/test/decompress_memory_test.js b/test/decompress_memory_test.js index f014b6c..99d1c56 100644 --- a/test/decompress_memory_test.js +++ b/test/decompress_memory_test.js @@ -6,7 +6,7 @@ var unzippedValue = fs.readFileSync('files/testfile', 'binary'); var data = fs.readFileSync('files/testfile.gz', 'binary'); // Check your memory usage for the node process while running this test! -for (var i = 0; i < 1000; i++) +for (var i = 0; i < 10000; i++) { gunzip.init(); var val = gunzip.inflate(data) + gunzip.end();