~/talk

How does code hot swapping work, and what are its pitfalls?

Talkat Jfokus 2025 · 2025-02-03..02-05· [java]
slides:none on file

Demo shows a tiny running program with an embedded webserver, decompiler and an Update button that compiles code and pushes classes into the JVM. Hot swap uses JVMTI-like hooks or the java.lang.instrumentation agent calling redefineClasses or retransform to replace bytecode; common generators are javac/compiler API, ASM or ByteBuddy. Works for turning tracing on or capturing locals but cannot add or remove fields or methods or change signatures or inheritance, and repeated swaps cause deoptimization, safepoint pauses and metaspace growth after hundreds or thousands.

AI-written summary · about

  1. 0:00Code hot swapping intro
  2. 2:31Hot swapping in Java
  3. 5:43JVM TI and Java agents
  4. 9:35Generating bytecode
  5. 10:39Hot swap use cases
  6. 11:42Hot swap pitfalls
  7. 13:11Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.