Tuesday 16 May 2017

In doing simple stress test Firebird on nodejs I got FATAL ERROR: Allocation failed - JavaScript heap out of memory

This code is working. But if I uncomment endless loop, there is no result. End memory insreasing for 2G, then it stops with error.

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

What am I doing wrong?

var Firebird = require('firebirdsql'); // or require('node-firebird');

var options = {};

options.host = '127.0.0.1';
options.port = 3050;
options.database = 'D:\\test\\test.FDB';
// ...

Firebird.attach(options, function(err, db) {

    if (err)
        throw err;

// while (1)    { // endless loop BEGIN
    db.query('SELECT first 1000 a.* FROM EVENTS a ORDER BY a.DATETIME', function(err, result) {
        if (err) throw err;

                for(r of result) {
                    console.log(r.datetime, ""+r.event_text);
                    // console.log(r.DATETIME, ""+r.EVENT_TEXT);  // for require('node-firebird');
                };
        // IMPORTANT: close the connection 
        db.detach();
    });

// } // endless loop END

});

I think this is not so important, but I am using v6.3.1 of node on windows 10.



via TadejP

No comments:

Post a Comment