memory leaks
Rich-Harris opened this issue · 6 comments
Rich-Harris commented
TrySound commented
I had this problem on windows. The only way to prevent it is using usePolling
paulmillr/chokidar#328
It's not the problem of chokidar itself, but chokidar at least has this solution.
hugomrdias commented
i have the same problem watching with gulp
let cache = null;
gulp.task('rollup', () => {
return rollup({
cache: cache,
entry: './app/scripts/main.js',
external: Object.keys(external),
plugins: [
replace({
include: [
'app/scripts/**/*.js'
],
values: {
__ENV__: JSON.stringify('dev'),
__DATE__: JSON.stringify('production'),
__VERSION__: JSON.stringify(pkg.version),
__TIMESTAMP__: JSON.stringify('production')
}
}),
nodeResolve({
jsnext: true,
main: true,
browser: true
}),
commonjs(),
json(),
jst(),
buble(),
size()
]
}).then(bundle => {
cache = bundle;
return bundle.write({
format: 'iife',
exports: 'none',
indent: false,
sourceMap: true,
globals: external,
dest: global.destFolder + '/scripts/app.js'
});
}).catch(handleErrorPromise('Rollup', global.isWatching));
});
gulp.watch('app/scripts/**/*.{js,tpl,json}', ['rollup']);
hugomrdias commented
last output
<--- Last few GCs --->
5366536 ms: Mark-sweep 1294.6 (1404.5) -> 1294.6 (1410.5) MB, 788.8 / 0.0 ms [allocation failure] [GC in old space requested].
5367332 ms: Mark-sweep 1294.6 (1410.5) -> 1294.6 (1410.5) MB, 796.1 / 0.0 ms [allocation failure] [GC in old space requested].
5368124 ms: Mark-sweep 1294.6 (1410.5) -> 1297.0 (1403.5) MB, 791.4 / 0.0 ms [last resort gc].
5368916 ms: Mark-sweep 1297.0 (1403.5) -> 1299.5 (1403.5) MB, 791.8 / 0.0 ms [last resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
2: arguments adaptor frame: 3->1
Security context: 0x382168acfb51 <JS Object>
3: InnerArrayForEach(aka InnerArrayForEach) [native array.js:~935] [pc=0x30ec0f0ca0e5] (this=0x382168a04381 <undefined>,bq=0x219cd15705c9 <JS Function (SharedFunctionInfo 0x1fb33524a599)>,br=0x382168a04381 <undefined>,w=0x1fb335296e69 <JS Array[1]>,x=1)
4: forEach [native array.js:~954] [pc=0x30ec0e856b1d] (this=0x1fb335296e69 <JS Array[1]>,bq=0x219c...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [gulp]
2: 0x1098b2c [gulp]
3: v8::Utils::ReportApiFailure(char const*, char const*) [gulp]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [gulp]
5: v8::internal::Factory::NewOneByteInternalizedString(v8::internal::Vector<unsigned char const>, unsigned int) [gulp]
6: v8::internal::AstRawStringInternalizationKey::AsHandle(v8::internal::Isolate*) [gulp]
7: v8::internal::StringTable::LookupKey(v8::internal::Isolate*, v8::internal::HashTableKey*) [gulp]
8: v8::internal::AstRawString::Internalize(v8::internal::Isolate*) [gulp]
9: v8::internal::AstValueFactory::Internalize(v8::internal::Isolate*) [gulp]
10: v8::internal::Parser::Internalize(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Script>, bool) [gulp]
11: v8::internal::Parser::Parse(v8::internal::ParseInfo*) [gulp]
12: v8::internal::Parser::ParseStatic(v8::internal::ParseInfo*) [gulp]
13: 0xb4a3de [gulp]
14: 0xb51b46 [gulp]
15: v8::internal::Compiler::Compile(v8::internal::Handle<v8::internal::JSFunction>, v8::internal::Compiler::ClearExceptionFlag) [gulp]
16: v8::internal::Runtime_CompileLazy(int, v8::internal::Object**, v8::internal::Isolate*) [gulp]
17: 0x30ec0c8092a7
[1] 9098 abort gulp
hugomrdias commented
should a post this issue on the main repo ?
jchook commented
@hugomrdias I can confirm that this is not isolated to rollup-watch. I am using gulp-watch and passing the bundle cache. Each build takes exponentially longer until it finally runs out of memory.
[14:28:37] Finished 'scripts' after 3.07 s
[14:28:38] Starting 'scripts'...
[14:28:47] Finished 'scripts' after 9.26 s
[14:29:03] Starting 'scripts'...
[14:29:21] Finished 'scripts' after 18 s
[14:30:35] Starting 'scripts'...
[14:32:08] Finished 'scripts' after 1.55 min
[14:32:09] Starting 'scripts'...
[14:35:40] Finished 'scripts' after 3.52 min
[14:35:40] Starting 'scripts'...
<--- Last few GCs --->
[39157:0x105000000] 1928379 ms: Mark-sweep 1405.6 (1528.0) -> 1405.4 (1512.0) MB, 1776.6 / 0.0 ms (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 1777 ms) last resort
[39157:0x105000000] 1930149 ms: Mark-sweep 1405.4 (1512.0) -> 1405.4 (1512.0) MB, 1768.9 / 0.0 ms last resort
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x3c511a1a9891 <JS Object>
1: dirname [path.js:~1344] [pc=0x110ad712c38c](this=0xa7305e0cd41 <an Object with map 0x6096dd29fa9>,path=0x27a38dd0e8e1 <String[54]: /Users/jchook/projects/by/master/diy/dist/js/client.js>)
2: collapseSourcemaps(aka collapseSourcemaps) [/Users/jchook/projects/by/master/diy/node_modules/rollup/dist/rollup.js:9141] [pc=0x110ad79f55e6](this=0x3f92d6202311 <undefined>,bundle=0x1bfa2cec1e29...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [/usr/local/bin/node]
2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]
3: v8::Utils::ReportOOMFailure(char const*, bool) [/usr/local/bin/node]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
5: v8::internal::Factory::NewRawOneByteString(int, v8::internal::PretenureFlag) [/usr/local/bin/node]
6: v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [/usr/local/bin/node]
7: v8::internal::Runtime_StringCharCodeAtRT(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
8: 0x110ad4b85bbc
Abort trap: 6
Rich-Harris commented
I think this can be closed now thanks to rollup/rollup#1470