rsmbl / Resemble.js

Image analysis and comparison

Home Page:http://rsmbl.github.io/Resemble.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FATAL ERROR: v8::ArrayBuffer::New Allocation failed - process out of memory

saamisam opened this issue · comments

I am getting this error

[26752:0x41cdab0]   248166 ms: Mark-sweep 22.5 (29.2) -> 21.9 (29.2) MB, 5.8 / 3.4 ms  (+ 15.6 ms in 20 steps since start of marking, biggest step 6.1 ms, walltime since start of marking 900 ms) (average mu = 0.988, current mu = 0.983) finalize incrementa[26752:0x41cdab0]   249372 ms: Mark-sweep 21.9 (29.2) -> 21.8 (29.2) MB, 1.4 / 0.0 ms  (+ 17.1 ms in 2 steps since start of marking, biggest step 12.6 ms, walltime since start of marking 1207 ms) (average mu = 0.987, current mu = 0.985) external memory pr



<--- JS stacktrace --->



==== JS stack trace =========================================



    0: ExitFrame [pc: 0x3dbf6385be1d]

Security context: 0x3a7cebe9e6e9 <JSObject>

    1: onLoadImage(aka onLoadImage) [0x32750561969] [/var/www/html/watchweb/node_modules/resemblejs/resemble.js:288] [bytecode=0x39726377f771 offset=157](this=0x18a5432026f1 <undefined>,hiddenImage=0x098ca34825e9 <Image map = 0x3eef06396159>,callback=0x032750569361 <JSFunction onceWeHaveBoth (sfi = 0x39726377dba1)>)

    2: /* anonymous */ [0x3275055f711] [/v...



FATAL ERROR: v8::ArrayBuffer::New Allocation failed - process out of memory

 1: 0x8fa0c0 node::Abort() [node]

 2: 0x8fa10c  [node]

 3: 0xb0026e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]

 4: 0xb004a4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]

 5: 0xb0058b  [node]

 6: 0xb1169e  [node]

 7: 0x7f8f4177a4bb Context2d::GetImageData(Nan::FunctionCallbackInfo<v8::Value> const&) [/var/www/html/watchweb/node_modules/canvas/build/Release/canvas.node]

 8: 0x7f8f4176f099  [/var/www/html/watchweb/node_modules/canvas/build/Release/canvas.node]

 9: 0xb8e6af  [node]

10: 0xb8f219 v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [node]

11: 0x3dbf6385be1d 

Aborted

and this is my code

    const options = {
        output: {
            errorColor: {
                red: 255,
                green: 0,
                blue: 0
            },
            errorType: "movement",
            transparency: 1,
            largeImageThreshold: 0,
            useCrossOrigin: true,
            outputDiff: true
        },
        scaleToSameSize: false,
    };
    for(var i=0; i<images.length; i++){
        var image1 = images[i]['image1'];
        var image2 = images[i]['image2'];
        try{
             const data = await compareImages(
                   image1,
                   image2,
                   options
             );
             var pixelmisMatchPercent = data.misMatchPercentage;
             console.log('pixelmisMatchPercent', pixelmisMatchPercent);
        }catch(e){
              console.log('e', e);
        }
    }

the above code works fine for about 40 iterations after that ArrayBuffer gets full and I am getting this error FATAL ERROR: v8::ArrayBuffer::New Allocation failed - process out of memory