Lagg Posted August 8, 2016 Report Posted August 8, 2016 (edited) Edit: Per the post below, this was backported in from v6.3.0 to v5.12.0 as well. Holy crap I thought there were just two active branches. Hi, so after like 3 months of trying to debug a memory leak (mckay can probably attest to all the posts I've made about this) and indeed even browsing node/v8's code I've finally found out why there's indefinite growth of memory usage even when the asset cache isn't used. A leak which shows up in snapshots as system-level retained objects (i.e. things we *never* control at the interpreter level). As it turns out there is a bug in versions of node prior to 4.4.5 where the handle to a VM context was generated as a global. Meaning no garbage collection. Since v2 made the wise decision of using VM contexts instead of straight evals - this of course triggered that bug. And every time a context was created it was putting every object in that context into a global for all intents and purposes. Here is the relevant change that corrected the issue in later node releases. Hope this PSA can save a few people the hassle and perhaps a few bug reports in the future. The relevant changes are tagged with "contextify": https://github.com/nodejs/node/blob/v4.4.5/CHANGELOG.md Edited August 9, 2016 by Lagg Quote
Dr. McKay Posted August 9, 2016 Report Posted August 9, 2016 That change hit the 5.x branch in v5.12.0, and the 6.x branch in v6.3.0. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.