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

still have memory leaks? #10

Open
HarryF514 opened this issue Dec 11, 2016 · 1 comment
Open

still have memory leaks? #10

HarryF514 opened this issue Dec 11, 2016 · 1 comment

Comments

@HarryF514
Copy link

with this code

var Crawler = require("node-webcrawler");
var url = require('url');
var jsdom = require('jsdom');
var c = new Crawler({
    maxConnections : 10,
    jQuery: jsdom,
    // This will be called for each crawled page
    callback : function (error, result, $) {
        // $ is Cheerio by default
        //a lean implementation of core jQuery designed specifically for the server
        if(error){
            console.log(error);
        }else{

            try {
                console.log($("title").text());
                $('a').each(function (index, a) {
                    var toQueueUrl = $(a).prop('href');
                    //console.log(toQueueUrl);
                    c.queue(toQueueUrl);
                });

            } catch (e) {
                console.log(e);
            }
        }
    }
});

c.queue('http://www.wandoujia.com/');

the memory will go up to 800MB after around 10 mins.

am I doing something wrong or it is the problem of the module itself?

thanks,

@mike442144
Copy link
Contributor

We suggest you to use default module: cheerio

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

2 participants