Explain how the Java Virtual Machine (JVM) manages memory, and describe your approach to diagnosing a memory leak in a production environment.