奇怪的堆内存不足node.js

时间:2019-03-21 13:43:29

标签: node.js memory-leaks heap

然后,我的节点服务器现在正从内存中耗尽堆。我尝试调试非常努力,但问题仍然存在。 我收到此错误

.temp

有时也会出现此错误

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
4|app |  1: node::Abort() [node /home/app/server.js]
4|app |  2: 0x1356bec [node /home/app/server.js]
4|app |  3: v8::Utils::ReportOOMFailure(char const*, bool) [node /home/app/server.js]
4|app |  4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node /home/app/server.js]
4|app |  5: v8::internal::Factory::NewFixedArray(int, v8::internal::PretenureFlag) [node /home/app/server.js]
4|app |  6: v8::internal::OrderedHashTable<v8::internal::OrderedHashSet, 1>::Allocate(v8::internal::Isolate*, int, v8::internal::PretenureFlag) [node /home/app/server.js]
4|app |  7: v8::internal::OrderedHashTable<v8::internal::OrderedHashSet, 1>::Rehash(v8::internal::Handle<v8::internal::OrderedHashSet>, int) [node /home/app/server.js]
4|app |  8: v8::internal::OrderedHashTable<v8::internal::OrderedHashSet, 1>::EnsureGrowable(v8::internal::Handle<v8::internal::OrderedHashSet>) [node /home/app/server.js]
4|app |  9: v8::internal::Runtime_SetGrow(int, v8::internal::Object**, v8::internal::Isolate*) [node /home/app/server.js]
4|app | 10: 0x7a8879046fd

请帮助我找出正在堆积的代码。我尝试使用工具来发现泄漏,但它只能告诉内存泄漏而不是泄漏。

1 个答案:

答案 0 :(得分:0)

这是一个名为Waterline.js的第三方ORM库,配置配置错误,集合之间存在冗余映射,因此将任何文档添加到db中并检查该文档属于哪个用户左右。而且收集恰好有13万多个文档,因此它可以获取我认为的所有内存并运行代码。