The Cycling Tour - Java's Fraught Relationship with Cyclic Object Graphs by Stuart Marks

  Рет қаралды 151

Devoxx

Devoxx

Күн бұрын

A Java program consists of objects that have references to each other. This is called the "object graph." It's easy to set up an object graph with cycles. If you do this, some things work, but other things break, sometimes in a surprising fashion. Cyclic object graphs don't come up very often, but when they do, they often result in difficult and subtle problems. Worse, the JDK doesn't provide much help here.Garbage collection works perfectly with cyclic object graphs. Early reference-counted GCs had problems with cycles, but modern tracing collectors handle them perfectly fine. This is a solved problem.The picture is less rosy in other parts of the system. A cyclic object graph using records or collections often results in a stack overflow or out-of-memory error.Java serialization claims to support cyclic object graphs. This works only in the simplest of cases. In more complex cases, deserialization will fail in subtle and unpleasant ways. There is a whole family of bug reports in the JDK Bug System that represents these different failure modes.I'll show several examples of cyclic object graphs that cause failures, and I'll explain these failures. I'll also explain why it's very difficult for the JDK to do anything effective to prevent them.Yet there are times when it's useful for Java applications to represent relationships that have cycles. I'll describe a set of techniques that can be used to represent cycles and that avoid the problems I've described.

Пікірлер
Postcards from the Peak of Complexity by Brian Goetz
23:52
Who’s the Real Dad Doll Squid? Can You Guess in 60 Seconds? | Roblox 3D
00:34
小路飞嫁祸姐姐搞破坏 #路飞#海贼王
00:45
路飞与唐舞桐
Рет қаралды 28 МЛН
How do Cats Eat Watermelon? 🍉
00:21
One More
Рет қаралды 13 МЛН
Help Me Celebrate! 😍🙏
00:35
Alan Chikin Chow
Рет қаралды 77 МЛН
The Chameleon Architect by Robin Custers
31:37
Devoxx
Рет қаралды 124
GC Tuning & Troubleshooting Crash Course | Ram Lakshmanan
52:02
JAX London
Рет қаралды 30 М.
Java 23 - Better Language, Better APIs, Better Runtime
57:39
Genesis Keynote by Stephan Janssen
58:50
Devoxx
Рет қаралды 135
Who’s the Real Dad Doll Squid? Can You Guess in 60 Seconds? | Roblox 3D
00:34