Java Memory Management: Values and References

Java Memory Management: Values and References

1h 16mIntermediate2021-12-07

Authors

Maaike van Putten

Maaike van Putten

Trainer and Developer for Java, Python, Spring Boot, and More

Course details

It's undeniably frustrating to need to restart an application due to performance issues. Did you know that this is often caused by poor memory management, though? Not only do you have the power to address it as a Java developer—you can prevent it altogether. In this course, instructor Maaike van Putten offers you a detailed look at how to deploy effective memory management solutions in Java.

Explore what gets stored where and why, and how you can exploit the differences to your advantage as a developer. Learn more about heap vs. stack storage, focusing on values, references, objects, and primitives, as well as their implications for better memory management. Get tips on escaping references and garbage collections as you develop your eye for seeing—and solving—new types of problems in your code.

Skills covered

JavaProgramming FoundationsOracleProgramming LanguagesSoftware DevelopmentDeep Dive (X:Y)

Concepts

0. Introduction

  • 01 - Make beautiful stack overflow errors
  • 02 - What you should know
  • 03 - Explore the code challenge environment

1. Java Memory Explained

  • 04 - What is Java memory
  • 05 - The importance of understanding Java memory
  • 06 - JVM and memory management
  • 07 - Stack memory
  • 08 - Heap memory
  • 09 - Heap vs. stack

2. Values vs. References

  • 10 - Primitives
  • 11 - Objects
  • 12 - Final classes and immutable objects
  • 13 - Strings in memory
  • 14 - Primitives and objects in memory
  • 15 - Solution - Making an object immutable

3. Careful - Escaping References

  • 16 - The problem of escaping references
  • 17 - Collections and escaping references
  • 18 - Avoiding escaping collection references
  • 19 - Example custom objects - References on the loose
  • 20 - Avoiding escaping references
  • 21 - Solution - Fixing an escaping reference

4. Quick Peek at Next Steps

  • 22 - Garbage collection
  • 23 - JVM tuning
  • 24 - Spotting and avoiding memory leaks
  • 25 - Solution - Fix the memory leak

Conclusion

  • 26 - Next steps with Java memory management
40,000 Toman