Memory Leak due to uncleared ThreadLocal

This post discusses the use of ThreadLocal variables in Java and highlights their potential to cause memory leaks if not managed properly. An example program demonstrates how infinite thread creation can lead to OutOfMemoryError. It emphasizes the importance of capturing and analyzing heap dumps to diagnose leaks and recommends removing ThreadLocal values to prevent issues.

Memory Leak Due To Time Taking finalize() Method

This post discusses the implicit inheritance in Java from java.lang.Object and the limitations of the finalize() method which can lead to OutOfMemoryError. It highlights alternatives for resource cleanup, such as try-with-resources and java.lang.ref.Cleaner, and emphasizes the importance of proper implementation to prevent application failures.

Symptoms of Memory Leak

Memory leaks pose significant performance challenges, characterized by gradual memory increase, CPU spikes, degraded response times, and potential OutOfMemoryError. Symptoms evidencing memory leaks include continual memory growth post-garbage collection, high CPU usage due to frequent garbage collection, and application thread pauses leading to transaction timeouts. Early detection is crucial for remediation.

Not So Common Memory Leaks & How to fix them?

Excess memory usage can slow down applications or cause crashes due to memory leaks, often traceable through heap dump analysis. Common causes include slow finalizer methods, uncleared ThreadLocal variables, and mutated keys in collections. Using tools like HeapHero can help identify and resolve these issues efficiently.

Optimizing the Capacity of a HashMap

Many of us know that allocating more memory than we need may negatively affect the performance of our application. Thus, creating the Lists using a constructor that takes a capacity may make a significant difference. However, this optimization step might not be so straightforward while using Maps. In this article, we’ll learn how to identify... Continue Reading →

Java SpringBoot – Performance Analysis and Tuning

SpringBoot is a widely used framework for building Java-based web applications and maintains a significant presence in the world of enterprise software development. It powers large-scale microservices and standalone applications. Most SpringBoot applications have embedded web servers and follow a distributed architecture consisting of three main types of application components: Backend: API services Backend: Event... Continue Reading →

Memory leak due to improper exception handling

In this post let's discuss an interesting memory problem we confronted in the production environment and how we went about solving it. This application would take traffic for a few hours after that it would become unresponsive. It wasn't clear what was causing the unresponsiveness in the application. Video: To see the visual walk-through of... Continue Reading →

Up ↑