nodejs
memory issues
One of the reasons nodejs
applications slow is lacking accountability when it comes to managing memory. We normally defer that memory management tasks the garbage collection. That is an answer to a couple of issues, that turned out to also to be a problem.
This blog takes a different approach, and only states facts about key memory hogs operations, and provides quick fixes, whenever there is, without going into too many details — or references.
In this article we will talk about:
- Identifying memory leak issues.
- Tracing
nodejs
application memory issues - Cleaning
nodejs
long-lasting objects - Production grade memory leak detection tools
Even though this blog post was designed to offer complementary materials to those who bought my Testing
nodejs
Applications book, the content can help any software developer to tuneup working environment. You use this link to buy the book.
Memory Leak
Managing memory can be a daunting task in nodejs
environment. Some strategies to detect and correct memory leaks can be found in the following articles.
This article is unfinished business and will be adding more content as I experience memory leak problems, or find some interesting use cases off Github and StackOverflow.
- Hunting a Ghost – Finding a Memory Leak in
nodejs
~ RisingStack Blog - Simple Guide to Finding a JavaScript Memory Leak in
nodejs
~ Alex Kras Blog - Tracking down Memory leaks in
nodejs
– Anodejs
Holiday Season ~ Mozilla Hacks - Export
this
: Interface Design Patterns fornodejs
Modules ~ GoodEggs - Node runs out of memory running our builds
nodejs
Performance Tip of the Week: Managing Garbage Collection ~ StrongLoop Blog- Memory management reference
- Understanding Garbage Collection and hunting Memory Leaks in
nodejs
~ Dynatrace Blog - Expose
gc
not working, a GitHub issue - Expose
gc
in Chrome-based testing environments ~ StackOverflow query - Using
process.memoryUsage()
to track heap use innodejs
apps ~nodejs
documentation - How to monitor Monitor memory usage for
nodejs
~ StackOverflow Query 56,418 Views so far
Conclusion
In this article, we focused on identifying potential sources of memory leaks in nodejs
applications and provided early detection mechanisms so that the same problem cannot happen again. There are additional complimentary materials on memory management in the “Testing nodejs
Applications book” book.