3

I'm creating bower package search site (everything is open sourced) and I hit the wall. I have some memory leak (or I think I have) and I honestly don't know why it is there.

You can download it and run on Your own, but simple hint will help me greatly.

I have narrowed it down to this function call here https://github.com/kamilbiela/bowereggs-backend/blob/master/main.js#L14 ( nest.fetchAndSave() ) which is all defined here: https://github.com/kamilbiela/bowereggs-backend/blob/master/lib/nest.js

Basically it downloads a package list from internet, Json.parse and inserts it into database, plus some when.js promises.

Running this function few times creates a 30mb of memory per run, that is not cleaned by garbage collector. Also note that this is my first "real" node.js project, so I'll be really grateful for any tip.

4

1 回答 1

2

对于任何有同样问题的人:

https://github.com/c4milo/node-webkit-agent

在进行了几次堆转储后,我发现对象被垃圾收集并且实际内存使用与它无关。我认为由于使用 mongo 和其他非 node.js 的东西,实际内存使用量更大。实际内存使用量也稳定在~300mb,堆转储在~35mb。

于 2014-01-06T12:51:24.143 回答