Hacker News new | ask | show | jobs
by Ubersoldat 5264 days ago
Detecting memory leaks is easy: run some stress tests before deploying to production! I mean, I don't see the use of this tool. Attach it to a live JVM to detect leaks which shouldn't be there?
3 comments

If you haven't had any memory leaks slip into production, you're in luck.

Also - if you can discover the leak in staging, the tool pinpoints the source of the leaks so that you don't have to waste time on reproduction, comparing heap dumps, and crawling through your code.

It tends to be more complex than this for several reasons:

a) you usually cannot simulate the exact behavior of users in production environment. Users tend to be quite creative in ways they approach your workflows and your artificial tests might not catch it b) Your dev/test/staging environment is usually not a 100% replica of the production site - you might lack access to some integrated systems, have different datasets for confidentiality reasons, use virtualized machines instead of physical, etc c) Or anything else which all leads to the sad fact that oftentimes you just cannot replicate the leak in any other env than production.

Totally agree and this tool might help in this situations but still I find it more suitable to simply watch the memory usage, which in a sane application, should have a pattern.
Finding out that you have a memory leak is a lot easier than to find what part of the code is responsible for that leak, for nontrivial code sizes.