Skip to content

still have memory leaks? #10

@HarryF514

Description

@HarryF514

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,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions