Garbage collection
We have already established that memory management is important when our goal is to have our Java applications perform at a high level. We also looked at how garbage completion works and what its benefits are.
Garbage collection implications
The automatic nature of Java’s garbage collection results in many developers ignoring it. They take garbage collection for granted and do not implement any best practices. This is okay for small projects that are not data- or memory-intensive. Let’s look at two ways that garbage collection can impact our applications and memory management:
- Application pauses: Frequent garbage collection cycles can result in our application pausing. The type of garbage collection and heap size are key determiners for the length of these pauses.
- Memory overhead: Garbage collection increases memory overhead. CPU cycles and memory resources are impacted each time garbage collection runs.
There are several approaches...