GithubHelp home page GithubHelp logo

woodya / node-gzbz2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from waveto/node-compress

15.0 15.0 11.0 171 KB

A streaming compression / gzip library for node.js

License: MIT License

C++ 70.88% JavaScript 18.52% Python 10.60%

node-gzbz2's People

Contributors

boaz0 avatar rlidwka avatar saltwaterc avatar waveto avatar woodya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

node-gzbz2's Issues

'auto_ptr' is not a member of 'std'

The current version configures just fine but throws the following errors on build:

[1/2] cxx: compress.cc -> build/default/compress_1.o
../compress.cc: In static member function ‘static v8::Handlev8::Value Gzip::GzipDeflate(const v8::Arguments&)’:
../compress.cc:193: error: ‘auto_ptr’ is not a member of ‘std’
../compress.cc:193: error: expected primary-expression before ‘>’ token
../compress.cc:193: error: ‘bw’ was not declared in this scope
../compress.cc:210: error: ‘auto_ptr’ is not a member of ‘std’
../compress.cc:210: error: expected primary-expression before ‘>’ token
../compress.cc: In static member function ‘static v8::Handlev8::Value Gunzip::GunzipInflate(const v8::Arguments&)’:
../compress.cc:405: error: ‘auto_ptr’ is not a member of ‘std’
../compress.cc:405: error: expected primary-expression before ‘>’ token
../compress.cc:405: error: ‘bw’ was not declared in this scope
../compress.cc:422: error: ‘auto_ptr’ is not a member of ‘std’
../compress.cc:422: error: expected primary-expression before ‘>’ token
../compress.cc: In static member function ‘static v8::Handlev8::Value Bzip::BzipDeflate(const v8::Arguments&)’:
../compress.cc:629: error: ‘auto_ptr’ is not a member of ‘std’
../compress.cc:629: error: expected primary-expression before ‘>’ token
../compress.cc:629: error: ‘bw’ was not declared in this scope
../compress.cc:646: error: ‘auto_ptr’ is not a member of ‘std’
../compress.cc:646: error: expected primary-expression before ‘>’ token
../compress.cc: In static member function ‘static v8::Handlev8::Value Bunzip::BunzipInflate(const v8::Arguments&)’:
../compress.cc:843: error: ‘auto_ptr’ is not a member of ‘std’
../compress.cc:843: error: expected primary-expression before ‘>’ token
../compress.cc:843: error: ‘bw’ was not declared in this scope
../compress.cc:860: error: ‘auto_ptr’ is not a member of ‘std’
../compress.cc:860: error: expected primary-expression before ‘>’ token

Build failed: -> task failed (err #1):
{task: cxx compress.cc -> compress_1.o}

Unsafe memory allocation

Buffer::New can return NULL but this is never checked (e.g. compress.cc:238), causing segfaults later on.

Memory leaks

var gzbz2 = require('gzbz2');
var data = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';

doTest();

function doTest() {
    // log usage
    console.log(process.memoryUsage().rss);

    // make a new instance
    var gzip = new gzbz2.Gzip;
    gzip.init({level:3});

    // call deflate more than once
    gzip.deflate(data);
    gzip.deflate(data);
    gzip.end();

    // clean up the V8 heap
    gzip = undefined;
    gc();

    // loop forever
    process.nextTick(doTest);
}

Call it as node --expose_gc leak.js and watch the memory usage grow...

Got this from valgrind as well

16,385 bytes in 1 blocks are definitely lost in loss record 49  of 51 
  at 0x4C2815C: malloc (vg_replace_malloc.c:236)
  by 0x4C281D6: realloc (vg_replace_malloc.c:525)
  by 0x2B640C4A: Gzip::GzipDeflate(v8::Arguments const&) (compress.cc:95)
  by 0x56D7A3: ??? (in /usr/local/bin/node) 

Gzip doesn't appear to leak if deflate is called only once.
Bzip leaks regardless of how many times you call it.

node 0.6.0 compatibility

node_events.h and the EventEmitter has been removed in node 0.5 and 0.6, which causes the build to fail with
../compress.cc:3: fatal error: node_events.h: No such file or directory.

Would it be possible to update the module to compile against 0.6, now a stable build has been released?

Is there any reason the classes have to extend EventEmitter, since they don't seem to use the Emit method?I've tried to modify it to extend ObjectWrap instead and call setClassName directly, which compiles but gives 'Unable to load shared library' errors; it's probably some mistake I've made.

Bzip core dumps

var zip = new bzgz2.Bzip();
zip.init({level: 4});
zip.end();

error:

assertion "ret == BZ_FINISH_OK" failed: file "../compress.cc", line 540, function: int Bzip::BzipEnd(char**, int*)
Aborted (core dumped)

The same code using Gzip() instead does not cause this error.

NodeJS v0.4.11, libbz2-devel 1.0.6-2 (cygwin)

Build fails on "npm install gzbz2": Missing node_events.h

> [email protected] preinstall /home/[...]/node_modules/gzbz2
> node-waf clean || true; node-waf configure build
Nothing to clean (project not configured)
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for program gcc or cc           : /usr/bin/gcc 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for gcc                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /usr 
Checking for library z                   : yes 
Checking for library bz2                 : not found 
'configure' finished successfully (3.188s)
Waf: Entering directory `/home/[...]/node_modules/gzbz2/build'
[1/2] cxx: compress.cc -> build/Release/compress_1.o
../compress.cc:2:25: fatal error: node_events.h: No such file or directory
compilation terminated.
Waf: Leaving directory `/home/krizz/dev/js/node/minecraft_js/node_modules/gzbz2/build'
Build failed:  -> task failed (err #1): 
    {task: cxx compress.cc -> compress_1.o}
npm ERR! error installing [email protected] Error: [email protected] preinstall: `node-waf clean || true; node-waf configure build`
npm ERR! error installing [email protected] `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1
npm ERR! error installing [email protected]     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing [email protected]     at ChildProcess.emit (events.js:70:17)
npm ERR! error installing [email protected]     at maybeExit (child_process.js:359:16)
npm ERR! error installing [email protected]     at Process.onexit (child_process.js:395:5)
npm ERR! [email protected] preinstall: `node-waf clean || true; node-waf configure build`
npm ERR! `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1
npm ERR! 
npm ERR! Failed at the [email protected] preinstall script.
npm ERR! This is most likely a problem with the gzbz2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-waf clean || true; node-waf configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls gzbz2
npm ERR! There is likely additional logging output above.
npm ERR! 
npm ERR! System Linux 3.0.0-12-generic
npm ERR! command "node" "/usr/bin/npm" "install" "gzbz2"
npm ERR! cwd /home/[...]
npm ERR! node -v v0.6.2
npm ERR! npm -v 1.0.104
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/[...]/npm-debug.log
npm not ok

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.