We shouldn't wait for memory leaks to come up as production issues. We can use some simple strategies to avoid them in the first place:
* Create memory leak unit tests - although those are flaky
* Run tests within a limited RAM VM
* Write APIs that log remaining bound objects when exiting
* Write stateless code where possible and familiarize yourself with the exact stateful aspects of your code. Inspect the stateful objects in a debugger to make sure they don't reference global state
* Periodically review your apps RAM usage and try to make sense of the objects you see in front of you
People Mentioned
Companies Mentioned
Coin Mentioned
Shai Almog
@shai.almog
Author, DevRel, Blogger, Open Source Hacker, Java Rockstar, Conference Speaker, Instructor and Entrepreneur