Ever wondered how memory allocation on the JVM works?
The Java Virtual Machine features many generational garbage collectors that also use pointer bumping for allocation. The combination of these two techniques gives a fast allocation and collection path which has led to a commonly held belief in the Java community that allocation in general is cheap. This talk will challenge that belief by looking at what happens outside of the fast path and considering the impact of even fast path allocation on other parts of the system, such as caches and memory bandwidth.
You will see how optimizations from the JIT can reduce or eliminate many allocations but how reasoning about when these happen can be almost impossible from glancing at code. Examples will introduce you to common problems and tooling you can use to understand the allocation behavior of your code.
From attending this talk you will understand:
– How allocation works in modern JVM Garbage Collectors
– Why allocation isn’t necessarily as cheap as it seems
– Why the JVM makes it difficult to reason about allocation behavior by code examination
– What kind of tooling you can use to understand the real allocation behavior of your code