Memory 配置(MemoryConfig)

基本信息

属性 值
配置类 com.mitchej123.hodgepodge.config.MemoryConfig
配置分类 memory(@Config(modid = "hodgepodge", category = "memory"),MemoryConfig.java:5)
源文件 src/main/java/com/mitchej123/hodgepodge/config/MemoryConfig.java
字段总数 29 个 boolean 开关,分装在 2 个静态容器里
容器 1 public static final MemoryLeakFixes leaks(MemoryConfig.java:9)—— 23 项泄漏修复
容器 2 public static final AllocationFixes allocs(MemoryConfig.java:12)—— 6 项分配优化
配置文件 config/hodgepodge.cfg 的 S:memory 段
GUI 可见 否 —— MemoryConfig 未列入 config/gui/HodgepodgeGuiConfig.java:23-29 的 7 个配置类,只能手改配置文件
挂载的 Mixin 数 22(leaks 16 次 + allocs 6 次,见 Mixins.java)

功能

本类处理两类问题:

  • 内存泄漏修复(MemoryLeakFixes,23 项):原版 / Forge 与第三方模组中「World 被长期持有」的路径。命名以 …WorldLeak / …Leak 结尾的项针对渲染器、控制器、网络处理器等持有 World 引用的静态或缓存对象。
  • 分配优化(AllocationFixes,6 项):减少一次性分配而非修复泄漏。

两者都是 public boolean 实例字段(其余配置类均为 public static),由 GTNHLib 的配置框架在容器对象上展开为配置文件里的条目。

⚠️ GUI 缺口(已核实):HodgepodgeGuiConfig 构造器传入的是 ASMConfig / DebugConfig / FixesConfig / GeneralConfig / SpeedupsConfig / TweaksConfig / SoundConfig 七个类,MemoryConfig 不在其中。因此游戏中 Mod Settings 里看不到 memory 分类,只能编辑 config/hodgepodge.cfg。

数值

容器 开关数 全部开关
MemoryConfig.leaks 23 见下表
MemoryConfig.allocs 6 见下表

明细

字段名、类型、默认值与说明直接取自 MemoryConfig.java:19-155,未作改写。

配置项 类型 默认值 说明
fixEntityRendererItemRendererLeak boolean true hodgepodge memory Memory leak fixes Memory allocation fixes Fix ItemRenderer keeping a reference to the last rendered item when leaving a world
fixEventBusMemoryLeak boolean true Fix EventBus keeping object references after unregistering event handlers.
fixMinecraftServerLeak boolean true Clears the reference to the minecraft server once it has stopped
fixCoFHWorldLeak boolean true Fix CoFH WorldServer leak in main mod class
fixNetworkChannelsMemoryLeak boolean true Fix memory leak caused by FML network channels attributes
fixServerCommandHandlerLeak boolean true Fix memory leak caused by minecraft’s commandBase keeping a static reference to the server command handler
fixRedstoneTorchWorldLeak boolean true Fix redstone torch leaking world
fixRenderersWorldLeak boolean true Fix EffectRenderer and RenderGlobal leaking world instance when leaving world
fixTileEntityRendererWorldLeak boolean true Fix TileEntityRenderer leaking world instance when leaving world
fixRenderManagerWorldLeak boolean true Fix RenderManager leaking world instance when leaving world
fixRenderBlocksWorldLeak boolean true Fix RenderBlocks static singleton leaking world instance when leaving world
fixPointedEntityLeak boolean true Fix PointedEntity leaking world instance when leaving world
fixEnchantmentHelperLeak boolean true Fix Enchantment Helper leaking world instance when leaving world
fixRenderFallingBlockLeak boolean true Fix Render Falling Block leaking world instance when leaving world
fixPlayerControllerWorldLeak boolean true Fix PlayerController leaking world instance when leaving world
fixNetHandlerClientWorldLeak boolean true Fix NetHandlerClient leaking world instance when leaving world
fixIC2BlockReactorLeak boolean true Fix IC2 block reactor leaking world instance when leaving world
fixWorldServerLeakingUnloadedEntities boolean true Fix WorldServer leaking entities when no players are present in a dimension
fixSkinManagerLeakingClientWorld boolean true Fix skin manager leaking client world
fixWorldMapStorageLeak boolean true Fix World static map storage leaking the server world
fixIC2TESRleak boolean true Fix IC2 TESR leaking the world instance
fixBibliocraftTESRWorldLeak boolean true Fix memory leaks in bibliocraft’s tile entity renderers
fixForgePlayerFactoryLeak boolean true Fix forge’s FakePlayerFactory leaking the world instance
clearFMLTextureErrors boolean true Clear FML Texture Errors to free memory
fixWitcheryEnumValuesSpam boolean true Stops witchery from spamming Enum#values()
cacheAdvancedModels boolean true Caches the advanced Model renderers to speedup loading and avoid wasting memory with duplicate models
deduplicateASMDataTableStrings boolean false Reduces the RAM usage of the ASMDataTable by interning the Strings
internResourceLocationDomain boolean false Reduce the memory usage from resource location domain strings
internUniqueIdentifierModid boolean false Reduce the memory usage from unique identifier modid strings