Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memleak in node.js binding #176

Open
vitage opened this issue Aug 27, 2014 · 4 comments
Open

Memleak in node.js binding #176

vitage opened this issue Aug 27, 2014 · 4 comments

Comments

@vitage
Copy link

vitage commented Aug 27, 2014

I test hyperdex example node.js code, and i found that code is not working.
I fix bugs and modernize example and start it.
Script leaks very fast. And It is not leak in node.js.

Tested on: Ubuntu 14.04 LTS, Calculate linux, Ubuntu 12.04 LTS

var hyperdex_client = require('hyperdex-client')
var hd = new hyperdex_client.Client('127.0.0.1', 1982)

var qlen = 0, count = 0, count_old = 0, err = 0, dt_old = new Date()

var loop = function() {
    var id = 'test_' + parseInt(Math.random()*1000000)
    qlen++;


    hd.get('test_kv', id , function(err){
        if (err) err++;
        count++;
        qlen--;
        return setImmediate(loop)
    })
}

setInterval(function() {
    var dt = new Date()
    var qps = (count - count_old) / (dt - dt_old) * 1000
    count_old = count
    dt_old = dt
    console.log('Processed '+count + ' pids, qps:', qps, 'qlen:', qlen, 'err:', err, Math.round(process.memoryUsage()['heapUsed']/1000/1000),'Mb')
}, 1000)

for (var i = 0; i < 2000; i++) setImmediate(loop)
@rescrv
Copy link
Owner

rescrv commented Aug 27, 2014

What version of Node are you using, and how did you install the bindings? I'd like to attempt to recreate.

@ctimoteo
Copy link

Hello,
i can confirm the memory leak with code above,
I have node version v0.10.29
and installed the npm module hyperdex-client

@Hamper
Copy link

Hamper commented Aug 28, 2014

With node version 0.10.31 and npm module hyperdex-client memory leak still exists

@vitage
Copy link
Author

vitage commented Aug 28, 2014

I have node version v0.10.31
npm install hyperdex-client

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants