节点js内存堆出文件上传

时间:2018-04-12 13:06:22

标签: node.js express

我正在尝试使用angular5 node js上传大小为200MB的文件。每次应用程序崩溃时都会出现以下错误。

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

Security context: 0x2c3a92b25ee1 <JSObject>
2: SimpleSlice(aka SimpleSlice) [native array.js:1] [bytecode=0x2c3aa14ed689 offset=41](this=0x2c3ad9b02311 <undefined>,p=0x2c3a51d2e961 <Uint8Array map = 0x2c3ad7ec1d91>,O=0,P=217330529,Q=217330529,R=0x2c3a51d6bce1 <JSArray[217330529]>)
4: ArraySliceFallback [native array.js:1] [bytecode=0x2c3aa14ed021 offset=281](this=0x2c3a51d2e961 <Uint8Array map = 0x2c3ad7ec1d91>,at=0,au=0x2c3ad9b02...

FATAL ERROR: invalid table size 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::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
4: v8::internal::HashTable<v8::internal::SeededNumberDictionary, v8::internal::SeededNumberDictionaryShape>::EnsureCapacity(v8::internal::Handle<v8::internal::SeededNumberDictionary>, int, v8::internal::PretenureFlag) [/usr/local/bin/node]
5: v8::internal::Dictionary<v8::internal::SeededNumberDictionary, v8::internal::SeededNumberDictionaryShape>::Add(v8::internal::Handle<v8::internal::SeededNumberDictionary>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyDetails, int*) [/usr/local/bin/node]
6: v8::internal::(anonymous namespace)::DictionaryElementsAccessor::AddImpl(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, unsigned int) [/usr/local/bin/node]
7: v8::internal::JSObject::AddDataElement(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow) [/usr/local/bin/node]
8: v8::internal::JSObject::DefineOwnPropertyIgnoreAttributes(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow, v8::internal::JSObject::AccessorInfoHandling) [/usr/local/bin/node]
9: v8::internal::JSObject::CreateDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::Object::ShouldThrow) [/usr/local/bin/node]
10: v8::internal::Runtime_CreateDataProperty(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
11: 0x12f2c16c6838

我尝试了不同的技术,但都是静脉。

--max-old-space-size=80896  --trace-gc-verbose

app.use(bodyParser.json({limit: '8096mb'}));

node获取超过1GB的活动监控时,崩溃发生。 我的开发环境是mac,8 GB ram。

0 个答案:

没有答案