Memory Leak in Hoglin Farm (VisualVM Analysis, Fig. 1)
A memory leak has been identified in a Hoglin farm (Fig. 2) in Minecraft 1.21.5. The farm was built in the crimson_forest biome and relies on despawning Hoglins in the Overworld when no player is within 128 blocks.
The issue also reproduces in earlier versions with a similar farm design (Fig. 3), as reported by Cupperum29 and marcogao.
Root Cause Hypothesis:
This appears to be a special case of entity retention when Hoglins are removed due to CHANGED_DIMENSION, referencing
possibly related
https://raw.githubusercontent.com/Winds-Studio/Leaf/2f72924ec7b24b8574ba50470b4217af96bf9452/leaf-server/minecraft-patches/features/0275-fix-MC-298464.patch