3

polymer buildより多くのコンポーネントを実装した後に実行すると、メモリが不足します。どのように可能ですか?自分のサイトやアプリはまだそれほど大きいとは考えていません ...

info:    Building application...
info:    Generating build/unbundled...
info:    Generating build/bundled...

<--- Last few GCs --->

  105411 ms: Mark-sweep 1343.6 (1434.7) -> 1343.0 (1434.7) MB, 1430.6 / 0 ms [allocation failure] [GC in old space requested].
  106857 ms: Mark-sweep 1343.0 (1434.7) -> 1343.0 (1434.7) MB, 1446.6 / 0 ms [allocation failure] [GC in old space requested].
  108349 ms: Mark-sweep 1343.0 (1434.7) -> 1343.0 (1434.7) MB, 1491.5 / 0 ms [last resort gc].
  109808 ms: Mark-sweep 1343.0 (1434.7) -> 1342.6 (1434.7) MB, 1459.5 / 0 ms [last resort gc].


<--- JS stacktrace --->

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

Security context: 0x24b44a0c9e31 <JS Object>
    2: nextToken [/Users/limjiewmeng/.nvm/versions/node/v6.4.0/lib/node_modules/polymer-cli/node_modules/acorn/dist/acorn.js:~2459] [pc=0x313c0f47bb3b] (this=0x3618e7c0f981 <a Parser with map 0x18a29db9aa01>)
    3: next [/Users/limjiewmeng/.nvm/versions/node/v6.4.0/lib/node_modules/polymer-cli/node_modules/acorn/dist/acorn.js:2413] [pc=0x313c0ee10d47] (this=0x3618e7c0f981 <a Parser with map 0x...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/Users/limjiewmeng/.nvm/versions/node/v6.4.0/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/Users/limjiewmeng/.nvm/versions/node/v6.4.0/bin/node]
 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/Users/limjiewmeng/.nvm/versions/node/v6.4.0/bin/node]
 4: v8::internal::Factory::NewFixedArray(int, v8::internal::PretenureFlag) [/Users/limjiewmeng/.nvm/versions/node/v6.4.0/bin/node]
 5: v8::internal::FullCodeGenerator::PopulateDeoptimizationData(v8::internal::Handle<v8::internal::Code>) [/Users/limjiewmeng/.nvm/versions/node/v6.4.0/bin/node]
 6: v8::internal::FullCodeGenerator::MakeCode(v8::internal::CompilationInfo*) [/Users/limjiewmeng/.nvm/versions/node/v6.4.0/bin/node]
 7: v8::internal::Compiler::EnsureDeoptimizationSupport(v8::internal::CompilationInfo*) [/Users/limjiewmeng/.nvm/versions/node/v6.4.0/bin/node]
 8: v8::internal::OptimizedCompileJob::CreateGraph() [/Users/limjiewmeng/.nvm/versions/node/v6.4.0/bin/node]
 9: v8::internal::Compiler::GetOptimizedCode(v8::internal::Handle<v8::internal::JSFunction>, v8::internal::Compiler::ConcurrencyMode, v8::internal::BailoutId, v8::internal::JavaScriptFrame*) [/Users/limjiewmeng/.nvm/versions/node/v6.4.0/bin/node]
10: v8::internal::(anonymous namespace)::CompileOptimized(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSFunction>, v8::internal::Compiler::ConcurrencyMode) [/Users/limjiewmeng/.nvm/versions/node/v6.4.0/bin/node]
11: v8::internal::Runtime_CompileOptimized_Concurrent(int, v8::internal::Object**, v8::internal::Isolate*) [/Users/limjiewmeng/.nvm/versions/node/v6.4.0/bin/node]
12: 0x313c0e50961b
13: 0x313c0e538279
[1]    8057 abort      polymer build

詳細モードで実行すると、いくつかの手がかりが得られました。

debug:   accept: bower_components/iron-behaviors/iron-control-state.html
debug:   accept: bower_components/paper-ripple/paper-ripple.html
debug:   accept: bower_components/paper-styles/color.html
debug:   accept: bower_components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html
debug:   accept: bower_components/iron-behaviors/iron-control-state.html
debug:   accept: bower_components/paper-ripple/paper-ripple.html
debug:   accept: bower_components/paper-styles/color.html
debug:   accept: bower_components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html
debug:   accept: bower_components/iron-behaviors/iron-control-state.html
debug:   accept: bower_components/paper-ripple/paper-ripple.html
debug:   accept: bower_components/paper-styles/color.html
debug:   accept: bower_components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html

ループで実行されているようですか?

アップデート

からいくつかのコンポーネントを削除するpolymer.jsonと、ビルドされますが、実際には必要なものではないことに気付きましたか?

更新 2: 考えられる回避策

すべてを断片化しないでください。一部のインポートをインライン化します。ビルド ツールが「より大きな」バンドルで同様の依存関係を見つけ、それらをグループ化できる可能性が高いため、問題を回避できると考えてください。それらをすべてのバンドルに含める必要はありません。

4

1 に答える 1