Skip to Content
Java Memory Management
book

Java Memory Management

by Maaike van Putten, Dr. Seán Kennedy
November 2022
Intermediate to advanced
146 pages
3h 16m
English
Packt Publishing
Content preview from Java Memory Management

3

Zooming in on the Heap Space

In Chapter 2, we discussed the differences between references and objects in memory. References and the objects to which they refer are closely related. We discovered that Java’s call-by-value mechanism could lead to a security issue known as escaping references, in addition to mutable objects. With the aid of sample code and diagrams, we examined the issues and how to resolve them using defensive copying.

We know that primitives and references can live on both the stack and the heap, whereas objects just live on the heap. Now, we are ready to take a closer look at the heap in preparation for the next chapter, which is on garbage collection (GC). In this chapter, we are going to cover the following topics:

  • Exploring ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Concurrency in Practice

Java Concurrency in Practice

Brian Goetz, Tim Peierls, Joshua Bloch, Joseph Bowbeer, David Holmes, Doug Lea
Troubleshooting Java

Troubleshooting Java

Laurentiu Spilca
The Well-Grounded Java Developer, Second Edition

The Well-Grounded Java Developer, Second Edition

Benjamin Evans, Martijn Verburg, Jason Clark
Java Coding Problems

Java Coding Problems

Anghel Leonard

Publisher Resources

ISBN: 9781801812856Supplemental Content