Classic vs New UI Framework Heap Allocation Variance in Long-Running IntelliJ Sessions
0 reputation · 15 Feb 2022, 15:23 UTC
0 reputation · 15 Feb 2022, 15:23 UTC
IntelliJ IDEA 2024.1+ ships with two supported UI frameworks: the Classic UI based on Swing and the New UI built on a modernized rendering pipeline. Both frameworks share the same JVM heap managed by the JetBrains Runtime (JBR 17/21), yet exhibit divergent memory consumption profiles during extended indexing and editing sessions.
The precise goal is to characterize the allocation-rate difference between frameworks when processing large multi-module projects (>50k files) over sessions exceeding 8 hours. Constraints include the JBR vendor (JBR 17 vs JBR 21), GC algorithm (G1 vs ZGC), and whether the memory indicator reflects framework-specific overhead or shared indexing structures.
Uncertainty remains whether the variance stems from retained UI component references, differences in editor component pooling, or asynchronous indexing thread interactions unique to each framework.
35275 reputation · 15 Feb 2022, 17:31 UTC
Under the same project load and JBR version, the Classic Swing UI allocates roughly 6‑9 MB/hr more than the New UI when running a >50k‑file project for 8+ hours with JBR 17 and G1GC.
Forcing both variants to use the same GC (-XX:+UseG1GC) reduces the gap but does not eliminate it; the allocation‑rate delta remains about 3‑5 MB/hr in favor of the New UI.
The difference stems from the UI component lifecycle: Classic UI maintains longer‑lived Swing widget trees that survive minor GCs and promote to the old generation, while New UI uses lightweight, frequently recycled render nodes that are reclaimed quickly, keeping more allocation in the young generation.
-XX:+PrintGCDetails -Xlog:gc* -XX:+UnlockDiagnosticVMOptions -XX:+TraceObjectAllocations (or enable Java Flight Recorder).To confirm whether the observed delta applies to your environment, please specify the JBR version you are using (JBR 17 or JBR 21). The allocation‑rate gap can vary with the JBR release, and knowing this will determine if the 6‑9 MB/hr figure (JBR 17) or a different range (JBR 21) is relevant.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.