Java Memory Management
3h 1mIntermediate2018-12-19
Authors

Matt Greencroft
Matt Greencroft is a full-time trainer and software development consultant.
Course details
By taking the time to learn how memory works in Java, you can avoid introducing problems in your code, as well as more effectively find and fix any memory errors that still occur. In this hands-on course, join instructor Matt Greencroft as he details how memory works in Java. Matt goes over essential concepts such as the roles of the stack and the heap, escaping references, garbage collection, detecting soft leaks, and more. Plus, he lends a real-world context to these concepts by demonstrating how to hunt for—and fix—a memory leak in a sample Java web application. While Matt works with Eclipse and Java 8 throughout the course, the material he covers is valid for any IDE and Java 6 and above.
Learning objectives
How memory works in Java
Passing variables by value
How objects are passed
What are escaping references?
How to avoid escaping references with collections and custom objects
Garbage collection and generation sizes
Detecting soft leaks
Choosing a garbage collector
Tuning a virtual machine
Fixing a memory leak
Learning objectives
How memory works in Java
Passing variables by value
How objects are passed
What are escaping references?
How to avoid escaping references with collections and custom objects
Garbage collection and generation sizes
Detecting soft leaks
Choosing a garbage collector
Tuning a virtual machine
Fixing a memory leak
Skills covered
JavaProgramming FoundationsOracleProgramming LanguagesSoftware DevelopmentOne-Off
Concepts
0. Introduction
- 01 - Introduction
1. How Memory Works in Java
- 02 - Why memory is important
- 03 - The role of the stack
- 04 - The role of the Heap
2. Values and References
- 05 - Passing variables by value
- 06 - How objects are passed
- 07 - The final keyword
- 08 - Memory exercise
- 09 - Exercise walkthrough
3. Escaping References
- 10 - What are escaping references
- 11 - An escaping references example
- 12 - How to avoid escaping references with collections
- 13 - Avoiding escaping references with custom objects, part 1
- 14 - Avoiding escaping references with custom objects, part 2
- 15 - Escaping references exercise
- 16 - Exercise walkthrough
4. Introduction to Garbage Collection
- 17 - String pools
- 18 - Garbage eligibility
- 19 - The gc() and finalize() methods
- 20 - Understanding what soft leaks are
- 21 - Detecting soft leaks
5. Generational Garbage Collection
- 22 - Mark and sweep
- 23 - Generational garbage collection
- 24 - Using the Visual GC tool to view a soft leak
- 25 - Using the Memory Analyzer tool
- 26 - PermGen and the Metaspace
6. Tuning the Virtual Machine
- 27 - Heap size
- 28 - PermGen size
- 29 - Garbage collection and generation sizes
- 30 - Generating heap dumps
- 31 - Choosing a garbage collector
7. Hunting for a Memory Leak
- 32 - Introducing the example application
- 33 - Monitoring the application
- 34 - Fixing a memory leak
Conclusion
- 35 - Course summary
Related courses
- Java Memory Management: Values and References
- Java Memory Management: Garbage Collection, JVM Tuning, and Spotting Memory Leaks
- Spring 6: Spring Security
- Advanced Java: Threads and Concurrency
- Java Profiling
- Java Essential Training: Objects and APIs
- Java 8+ Essential Training: Objects and APIs
- Rust for Java Developers
Related learn paths
- Become a Java Programmer
- Getting Started as a Java Developer
- A Quick Start Guide to Java Programming
- Explore a Career as a JavaScript Developer
- Prepare for the MTA: Software Development Fundamentals Exam (98-361)
- Become a Programmer: Foundations
- Java Foundations Professional Certificate by JetBrains
- The Top Skills Engineering Professionals Have Right Now