meltingice / CamanJS

Javascript HTML5 (Ca)nvas (Man)ipulation
http://camanjs.com
BSD 3-Clause "New" or "Revised" License
3.56k stars 406 forks source link

Serious memory leak #96

Closed lukaszfiszer closed 11 years ago

lukaszfiszer commented 11 years ago

While testing CamanJS in a worker queue, I spotted a serious a memory leak. Just loading a 300Kb image via Caman constructor, without any processing, results in about 30Mb of RAM being eaten by node process.

I can be easily reproduced by running this simple script:

var Caman    = require('caman').Caman;
var async    = require('async');
var imagePath = 'image.jpg';

async.whilst(
  function() {
    return true;
  },
  function(callback) {
    Caman(imagePath, function () {
      console.log(process.memoryUsage());
      setTimeout(callback,1500);
    });
  },
  function () {}
);

After 1 minute the script took 500Mo of memory and was still growing, with no upper limit (I've easily reached 1.5Go, with heavy swapping and system getting very slow). memoryUsage

The console reports:

{ rss: 38367232, heapTotal: 6213376, heapUsed: 2995436 }
{ rss: 63401984, heapTotal: 6213376, heapUsed: 3366956 }
{ rss: 88141824, heapTotal: 6213376, heapUsed: 3400024 }
{ rss: 113369088, heapTotal: 8310528, heapUsed: 2604128 }
{ rss: 138055680, heapTotal: 8310528, heapUsed: 2672052 }
{ rss: 162734080, heapTotal: 8310528, heapUsed: 2690724 }
{ rss: 187408384, heapTotal: 8310528, heapUsed: 2698168 }
(...)
{ rss: 606855168, heapTotal: 8310528, heapUsed: 2604112 }
{ rss: 631537664, heapTotal: 8310528, heapUsed: 2587252 }
{ rss: 655818752, heapTotal: 8310528, heapUsed: 2597564 }
{ rss: 680493056, heapTotal: 8310528, heapUsed: 2605500 }
{ rss: 705187840, heapTotal: 8310528, heapUsed: 2618136 }

I've also run the script on Heroku to check if it's not an architecture issue. Got same results plus, at the end:

2013-07-26T23:47:04.031043+00:00 heroku[worker.1]: Process running mem=512M(100.0%)
2013-07-26T23:47:04.031325+00:00 heroku[worker.1]: Error R14 (Memory quota exceeded)

What is interesting it that the heap size stays flat, with rss eating all the memory. According to this post http://stackoverflow.com/questions/13126808/whats-the-node-js-memory-breakdown. "(RSS usage) must be external buffers and other memory used by non-V8 objects". Could it mean that this memory is taken by bindings to native libraries used by node-canvas?

I tested on node versions v0.6.21, 0.8.25, 0.10.5, 0.10.15.

Here's the complete repo that can be used to reproduce the bug : https://github.com/lukaszfiszer/caman-memory-leak

lukaszfiszer commented 11 years ago

Could be related: https://github.com/joyent/node/issues/5345 http://stackoverflow.com/questions/14714151/node-js-memory-leak-despite-constant-heap-rss-sizes

meltingice commented 11 years ago

I think it does have to do with external buffers and native bindings. If you run your script with external memory debugging enabled, it looks like this:

➜  CamanJS git:(master) ✗ node --trace_external_memory script.js
[4722]       20 ms: Adjust amount of external memory: delta=     8 KB,  amount=     8 KB, isolate=0x101007800.
[4722]       22 ms: Adjust amount of external memory: delta=    69 KB,  amount=    77 KB, isolate=0x101007800.
[4722]       27 ms: Adjust amount of external memory: delta=    10 KB,  amount=    87 KB, isolate=0x101007800.
[4722]       30 ms: Adjust amount of external memory: delta=     8 KB,  amount=    95 KB, isolate=0x101007800.
[4722]       32 ms: Adjust amount of external memory: delta=    -8 KB,  amount=    87 KB, isolate=0x101007800.
[4722]       32 ms: Adjust amount of external memory: delta=   -69 KB,  amount=    18 KB, isolate=0x101007800.
[4722]       32 ms: Adjust amount of external memory: delta=   -10 KB,  amount=     8 KB, isolate=0x101007800.
[4722]       32 ms: Adjust amount of external memory: delta=     8 KB,  amount=    16 KB, isolate=0x101007800.
[4722]       36 ms: Adjust amount of external memory: delta=    14 KB,  amount=    30 KB, isolate=0x101007800.
[4722]       39 ms: Adjust amount of external memory: delta=    44 KB,  amount=    74 KB, isolate=0x101007800.
[4722]       40 ms: Adjust amount of external memory: delta=    28 KB,  amount=   103 KB, isolate=0x101007800.
[4722]       42 ms: Adjust amount of external memory: delta=   -14 KB,  amount=    88 KB, isolate=0x101007800.
[4722]       43 ms: Adjust amount of external memory: delta=   -44 KB,  amount=    44 KB, isolate=0x101007800.
[4722]       43 ms: Adjust amount of external memory: delta=   -28 KB,  amount=    16 KB, isolate=0x101007800.
[4722]       88 ms: Adjust amount of external memory: delta=  4280 KB,  amount=  4296 KB, isolate=0x101007800.
[4722]       89 ms: Adjust amount of external memory: delta=  4280 KB,  amount=  8576 KB, isolate=0x101007800.
[4722]       91 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 12856 KB, isolate=0x101007800.
[4722]      105 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 17136 KB, isolate=0x101007800.
[4722]      105 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 21416 KB, isolate=0x101007800.
{ rss: 39215104, heapTotal: 7195904, heapUsed: 2924080 }
[4722]     1686 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 25696 KB, isolate=0x101007800.
[4722]     1687 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 29976 KB, isolate=0x101007800.
[4722]     1689 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 34256 KB, isolate=0x101007800.
[4722]     1701 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 38536 KB, isolate=0x101007800.
[4722]     1701 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 42816 KB, isolate=0x101007800.
{ rss: 63848448, heapTotal: 7195904, heapUsed: 3399248 }
[4722]     3259 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 47096 KB, isolate=0x101007800.
[4722]     3259 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 51376 KB, isolate=0x101007800.
[4722]     3262 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 55656 KB, isolate=0x101007800.
[4722]     3275 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 59936 KB, isolate=0x101007800.
[4722]     3275 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 64216 KB, isolate=0x101007800.

You can see that the amount of external memory used for each instance increases by about 21.4MB each time Caman is initialized, and it is never reclaimed (unlike the memory allocated during node startup).

The only native dependencies that CamanJS uses are LearnBoost/node-canvas and laverdet/node-fibers. I'll have to try and narrow down which one is the culprit (if either of them even are).

meltingice commented 11 years ago

So I removed node-fibers and it exhibited the same memory behavior, which leads me to think that node-canvas is the culprit.

meltingice commented 11 years ago

Okay, I found the root of the problem. Looks like the way that node-canvas was being initialized made it impossible for the node garbage collector to reclaim a lot of memory. Now when it's run, you can see exactly when the GC makes a run and effectively clears out the external buffer memory.

➜  CamanJS git:(master) ✗ node --trace_external_memory script.js
[5393]       21 ms: Adjust amount of external memory: delta=     8 KB,  amount=     8 KB, isolate=0x101007800.
[5393]       23 ms: Adjust amount of external memory: delta=    69 KB,  amount=    77 KB, isolate=0x101007800.
[5393]       29 ms: Adjust amount of external memory: delta=    10 KB,  amount=    87 KB, isolate=0x101007800.
[5393]       34 ms: Adjust amount of external memory: delta=     8 KB,  amount=    95 KB, isolate=0x101007800.
[5393]       36 ms: Adjust amount of external memory: delta=    -8 KB,  amount=    87 KB, isolate=0x101007800.
[5393]       36 ms: Adjust amount of external memory: delta=   -69 KB,  amount=    18 KB, isolate=0x101007800.
[5393]       36 ms: Adjust amount of external memory: delta=   -10 KB,  amount=     8 KB, isolate=0x101007800.
[5393]       36 ms: Adjust amount of external memory: delta=     8 KB,  amount=    16 KB, isolate=0x101007800.
[5393]       41 ms: Adjust amount of external memory: delta=    14 KB,  amount=    30 KB, isolate=0x101007800.
[5393]       44 ms: Adjust amount of external memory: delta=    44 KB,  amount=    74 KB, isolate=0x101007800.
[5393]       45 ms: Adjust amount of external memory: delta=    28 KB,  amount=   103 KB, isolate=0x101007800.
[5393]       48 ms: Adjust amount of external memory: delta=   -14 KB,  amount=    88 KB, isolate=0x101007800.
[5393]       48 ms: Adjust amount of external memory: delta=   -44 KB,  amount=    44 KB, isolate=0x101007800.
[5393]       48 ms: Adjust amount of external memory: delta=   -28 KB,  amount=    16 KB, isolate=0x101007800.
[5393]       49 ms: Adjust amount of external memory: delta=  2042 KB,  amount=  2058 KB, isolate=0x101007800.
[5393]       91 ms: Adjust amount of external memory: delta=  4280 KB,  amount=  6338 KB, isolate=0x101007800.
[5393]       91 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 10618 KB, isolate=0x101007800.
[5393]       94 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 14898 KB, isolate=0x101007800.
[5393]      107 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 19178 KB, isolate=0x101007800.
[5393]      107 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 23458 KB, isolate=0x101007800.
{ rss: 41918464, heapTotal: 7195904, heapUsed: 2945520 }
[5393]     1644 ms: Adjust amount of external memory: delta=  2042 KB,  amount= 25501 KB, isolate=0x101007800.
[5393]     1688 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 29781 KB, isolate=0x101007800.
[5393]     1688 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 34061 KB, isolate=0x101007800.
[5393]     1691 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 38341 KB, isolate=0x101007800.
[5393]     1704 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 42621 KB, isolate=0x101007800.
[5393]     1704 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 46901 KB, isolate=0x101007800.
{ rss: 68403200, heapTotal: 7195904, heapUsed: 3426264 }
[5393]     3219 ms: Adjust amount of external memory: delta=  2042 KB,  amount= 48944 KB, isolate=0x101007800.
[5393]     3262 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 53224 KB, isolate=0x101007800.
[5393]     3263 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 57504 KB, isolate=0x101007800.
[5393]     3265 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 61784 KB, isolate=0x101007800.
[5393]     3277 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 66064 KB, isolate=0x101007800.
[5393]     3278 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 70344 KB, isolate=0x101007800.
{ rss: 94089216, heapTotal: 7195904, heapUsed: 3494312 }
[5393]     4792 ms: Adjust amount of external memory: delta=  2042 KB,  amount= 72387 KB, isolate=0x101007800.
[5393]     4836 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 76667 KB, isolate=0x101007800.
[5393]     4836 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 80947 KB, isolate=0x101007800.
[5393]     4838 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 85227 KB, isolate=0x101007800.
[5393]     4851 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 89507 KB, isolate=0x101007800.
[5393]     4851 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 93787 KB, isolate=0x101007800.
{ rss: 120455168, heapTotal: 7195904, heapUsed: 3559336 }
[5393]     6366 ms: Adjust amount of external memory: delta=  2042 KB,  amount= 95830 KB, isolate=0x101007800.
[5393]     6410 ms: Adjust amount of external memory: delta=  4280 KB,  amount=100110 KB, isolate=0x101007800.
[5393]     6410 ms: Adjust amount of external memory: delta=  4280 KB,  amount=104390 KB, isolate=0x101007800.
[5393]     6412 ms: Adjust amount of external memory: delta=  4280 KB,  amount=108670 KB, isolate=0x101007800.
[5393]     6425 ms: Adjust amount of external memory: delta=  4280 KB,  amount=112950 KB, isolate=0x101007800.
[5393]     6425 ms: Adjust amount of external memory: delta=  4280 KB,  amount=117230 KB, isolate=0x101007800.
{ rss: 146313216, heapTotal: 7195904, heapUsed: 3583760 }
[5393]     7939 ms: Adjust amount of external memory: delta=  2042 KB,  amount=119272 KB, isolate=0x101007800.
[5393]     7984 ms: Adjust amount of external memory: delta=  4280 KB,  amount=123552 KB, isolate=0x101007800.
[5393]     7984 ms: Adjust amount of external memory: delta=  4280 KB,  amount=127832 KB, isolate=0x101007800.
[5393]     7987 ms: Adjust amount of external memory: delta=  4280 KB,  amount=132112 KB, isolate=0x101007800.
[5393]     8000 ms: Adjust amount of external memory: delta=  4280 KB,  amount=136392 KB, isolate=0x101007800.
[5393]     8000 ms: Adjust amount of external memory: delta=  4280 KB,  amount=140672 KB, isolate=0x101007800.
{ rss: 172417024, heapTotal: 7195904, heapUsed: 3601672 }
[5393]     9514 ms: Adjust amount of external memory: delta=  2042 KB,  amount=142715 KB, isolate=0x101007800.
[5393]     9554 ms: Adjust amount of external memory: delta=  4280 KB,  amount=146995 KB, isolate=0x101007800.
[5393]     9554 ms: Adjust amount of external memory: delta=  4280 KB,  amount=151275 KB, isolate=0x101007800.
[5393]     9556 ms: Adjust amount of external memory: delta=  4280 KB,  amount=155555 KB, isolate=0x101007800.
[5393]     9569 ms: Adjust amount of external memory: delta=  4280 KB,  amount=159835 KB, isolate=0x101007800.
[5393]     9569 ms: Adjust amount of external memory: delta=  4280 KB,  amount=164115 KB, isolate=0x101007800.
{ rss: 198516736, heapTotal: 7195904, heapUsed: 3619584 }
[5393]    11083 ms: Adjust amount of external memory: delta=  2042 KB,  amount=166158 KB, isolate=0x101007800.
[5393]    11126 ms: Adjust amount of external memory: delta=  4280 KB,  amount=170438 KB, isolate=0x101007800.
[5393]    11126 ms: Adjust amount of external memory: delta=  4280 KB,  amount=174718 KB, isolate=0x101007800.
[5393]    11128 ms: Adjust amount of external memory: delta=  4280 KB,  amount=178998 KB, isolate=0x101007800.
[5393]    11141 ms: Adjust amount of external memory: delta=  4280 KB,  amount=183278 KB, isolate=0x101007800.
[5393]    11141 ms: Adjust amount of external memory: delta=  4280 KB,  amount=187558 KB, isolate=0x101007800.
{ rss: 224817152, heapTotal: 7195904, heapUsed: 3639232 }
[5393]    12656 ms: Adjust amount of external memory: delta=  2042 KB,  amount=189601 KB, isolate=0x101007800.
[5393]    12700 ms: Adjust amount of external memory: delta=  4280 KB,  amount=193881 KB, isolate=0x101007800.
[5393]    12700 ms: Adjust amount of external memory: delta=  4280 KB,  amount=198161 KB, isolate=0x101007800.
[5393]    12702 ms: Adjust amount of external memory: delta=  4280 KB,  amount=202441 KB, isolate=0x101007800.
[5393]    12716 ms: Adjust amount of external memory: delta=  4280 KB,  amount=206721 KB, isolate=0x101007800.
[5393]    12716 ms: Adjust amount of external memory: delta=  4280 KB,  amount=211001 KB, isolate=0x101007800.
{ rss: 250925056, heapTotal: 7195904, heapUsed: 3659680 }
[5393]    14229 ms: Adjust amount of external memory: delta=  2042 KB,  amount=213044 KB, isolate=0x101007800.
[5393]    14272 ms: Adjust amount of external memory: delta=  4280 KB,  amount=217324 KB, isolate=0x101007800.
[5393]    14273 ms: Adjust amount of external memory: delta=  4280 KB,  amount=221604 KB, isolate=0x101007800.
[5393]    14275 ms: Adjust amount of external memory: delta=  4280 KB,  amount=225884 KB, isolate=0x101007800.
[5393]    14288 ms: Adjust amount of external memory: delta=  4280 KB,  amount=230164 KB, isolate=0x101007800.
[5393]    14288 ms: Adjust amount of external memory: delta=  4280 KB,  amount=234444 KB, isolate=0x101007800.
{ rss: 277028864, heapTotal: 7195904, heapUsed: 3683720 }
[5393]    15801 ms: Adjust amount of external memory: delta=  2042 KB,  amount=236486 KB, isolate=0x101007800.
[5393]    15846 ms: Adjust amount of external memory: delta=  4280 KB,  amount=240766 KB, isolate=0x101007800.
[5393]    15846 ms: Adjust amount of external memory: delta=  4280 KB,  amount=245046 KB, isolate=0x101007800.
[5393]    15849 ms: Adjust amount of external memory: delta=  4280 KB,  amount=249326 KB, isolate=0x101007800.
[5393]    15866 ms: Adjust amount of external memory: delta=  4280 KB,  amount=253606 KB, isolate=0x101007800.
[5393]    15866 ms: Adjust amount of external memory: delta=  4280 KB,  amount=257886 KB, isolate=0x101007800.
{ rss: 303149056, heapTotal: 7195904, heapUsed: 3701472 }
[5393]    17380 ms: Adjust amount of external memory: delta=  2042 KB,  amount=259929 KB, isolate=0x101007800.
[5393]    17426 ms: Adjust amount of external memory: delta=    -8 KB,  amount=264201 KB, isolate=0x101007800.
[5393]    17426 ms: Adjust amount of external memory: delta= -2042 KB,  amount=262158 KB, isolate=0x101007800.
[5393]    17426 ms: Adjust amount of external memory: delta= -4280 KB,  amount=257878 KB, isolate=0x101007800.
[5393]    17426 ms: Adjust amount of external memory: delta= -2042 KB,  amount=255836 KB, isolate=0x101007800.
[5393]    17427 ms: Adjust amount of external memory: delta= -4280 KB,  amount=251556 KB, isolate=0x101007800.
[5393]    17427 ms: Adjust amount of external memory: delta= -2042 KB,  amount=249513 KB, isolate=0x101007800.
[5393]    17427 ms: Adjust amount of external memory: delta= -4280 KB,  amount=245233 KB, isolate=0x101007800.
[5393]    17428 ms: Adjust amount of external memory: delta= -4280 KB,  amount=240953 KB, isolate=0x101007800.
[5393]    17428 ms: Adjust amount of external memory: delta= -4280 KB,  amount=236673 KB, isolate=0x101007800.
[5393]    17429 ms: Adjust amount of external memory: delta= -4280 KB,  amount=232393 KB, isolate=0x101007800.
[5393]    17430 ms: Adjust amount of external memory: delta= -2042 KB,  amount=230350 KB, isolate=0x101007800.
[5393]    17430 ms: Adjust amount of external memory: delta= -4280 KB,  amount=226070 KB, isolate=0x101007800.
[5393]    17430 ms: Adjust amount of external memory: delta= -4280 KB,  amount=221790 KB, isolate=0x101007800.
[5393]    17431 ms: Adjust amount of external memory: delta= -4280 KB,  amount=217510 KB, isolate=0x101007800.
[5393]    17432 ms: Adjust amount of external memory: delta= -4280 KB,  amount=213230 KB, isolate=0x101007800.
[5393]    17432 ms: Adjust amount of external memory: delta= -2042 KB,  amount=211187 KB, isolate=0x101007800.
[5393]    17433 ms: Adjust amount of external memory: delta= -4280 KB,  amount=206907 KB, isolate=0x101007800.
[5393]    17433 ms: Adjust amount of external memory: delta= -4280 KB,  amount=202627 KB, isolate=0x101007800.
[5393]    17434 ms: Adjust amount of external memory: delta= -4280 KB,  amount=198347 KB, isolate=0x101007800.
[5393]    17436 ms: Adjust amount of external memory: delta= -4280 KB,  amount=194067 KB, isolate=0x101007800.
[5393]    17436 ms: Adjust amount of external memory: delta= -2042 KB,  amount=192024 KB, isolate=0x101007800.
[5393]    17437 ms: Adjust amount of external memory: delta= -4280 KB,  amount=187744 KB, isolate=0x101007800.
[5393]    17437 ms: Adjust amount of external memory: delta= -4280 KB,  amount=183464 KB, isolate=0x101007800.
[5393]    17438 ms: Adjust amount of external memory: delta= -4280 KB,  amount=179184 KB, isolate=0x101007800.
[5393]    17440 ms: Adjust amount of external memory: delta= -4280 KB,  amount=174904 KB, isolate=0x101007800.
[5393]    17440 ms: Adjust amount of external memory: delta= -2042 KB,  amount=172862 KB, isolate=0x101007800.
[5393]    17441 ms: Adjust amount of external memory: delta= -4280 KB,  amount=168582 KB, isolate=0x101007800.
[5393]    17441 ms: Adjust amount of external memory: delta= -4280 KB,  amount=164302 KB, isolate=0x101007800.
[5393]    17441 ms: Adjust amount of external memory: delta= -4280 KB,  amount=160022 KB, isolate=0x101007800.
[5393]    17443 ms: Adjust amount of external memory: delta= -4280 KB,  amount=155742 KB, isolate=0x101007800.
[5393]    17443 ms: Adjust amount of external memory: delta= -2042 KB,  amount=153699 KB, isolate=0x101007800.
[5393]    17444 ms: Adjust amount of external memory: delta= -4280 KB,  amount=149419 KB, isolate=0x101007800.
[5393]    17444 ms: Adjust amount of external memory: delta= -4280 KB,  amount=145139 KB, isolate=0x101007800.
[5393]    17445 ms: Adjust amount of external memory: delta= -4280 KB,  amount=140859 KB, isolate=0x101007800.
[5393]    17447 ms: Adjust amount of external memory: delta= -4280 KB,  amount=136579 KB, isolate=0x101007800.
[5393]    17447 ms: Adjust amount of external memory: delta= -2042 KB,  amount=134536 KB, isolate=0x101007800.
[5393]    17448 ms: Adjust amount of external memory: delta= -4280 KB,  amount=130256 KB, isolate=0x101007800.
[5393]    17448 ms: Adjust amount of external memory: delta= -4280 KB,  amount=125976 KB, isolate=0x101007800.
[5393]    17449 ms: Adjust amount of external memory: delta= -4280 KB,  amount=121696 KB, isolate=0x101007800.
[5393]    17450 ms: Adjust amount of external memory: delta= -4280 KB,  amount=117416 KB, isolate=0x101007800.
[5393]    17451 ms: Adjust amount of external memory: delta= -2042 KB,  amount=115373 KB, isolate=0x101007800.
[5393]    17451 ms: Adjust amount of external memory: delta= -4280 KB,  amount=111093 KB, isolate=0x101007800.
[5393]    17451 ms: Adjust amount of external memory: delta= -4280 KB,  amount=106813 KB, isolate=0x101007800.
[5393]    17452 ms: Adjust amount of external memory: delta= -4280 KB,  amount=102533 KB, isolate=0x101007800.
[5393]    17453 ms: Adjust amount of external memory: delta= -2042 KB,  amount=100490 KB, isolate=0x101007800.
[5393]    17454 ms: Adjust amount of external memory: delta= -4280 KB,  amount= 96210 KB, isolate=0x101007800.
[5393]    17455 ms: Adjust amount of external memory: delta= -4280 KB,  amount= 91930 KB, isolate=0x101007800.
[5393]    17455 ms: Adjust amount of external memory: delta= -4280 KB,  amount= 87650 KB, isolate=0x101007800.
[5393]    17456 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 87650 KB, isolate=0x101007800.
[5393]    17456 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 91930 KB, isolate=0x101007800.
[5393]    17458 ms: Adjust amount of external memory: delta=  4280 KB,  amount= 96210 KB, isolate=0x101007800.
[5393]    17469 ms: Adjust amount of external memory: delta=  4280 KB,  amount=100490 KB, isolate=0x101007800.
[5393]    17470 ms: Adjust amount of external memory: delta=  4280 KB,  amount=104770 KB, isolate=0x101007800.
lukaszfiszer commented 11 years ago

Great, for the fix! However with this commit it's not possible anymore to pass an image Buffer to Caman constructor:

var image = fs.readFileSync(imagePath);
Caman(image, function(){
   ...
});

I know that was un undocumented behavior, but I was very useful.

meltingice commented 11 years ago

That was fixed in the next commit, actually.