Halo 2.4.2 - 1.20.1 fabric (Adapter 2)
Curse Maven Snippet
What's new
Full Changelog: Here
- Fixed a JVM crash while preparing Halo's cached mesh generations. On 1.20.1 Halo owns the upload staging buffer's native memory because the platform has no
BufferAllocator/ByteBufferBuilder;MeshUploadBuffer.close()freed that block but left its address inBufferBuilder, so any later cleanup path reading the same buffer - ModernFix injects aBufferBuilder.finalizethat callsUnsafeBufferHelper.free- freed the same memory a second time and killed the process insidejemallocwith anEXCEPTION_ACCESS_VIOLATION(Finalizerthread,jemalloc.dll). MeshUploadBuffer.close()now takes the buffer out of the builder (newBufferBuilderStorageAccessor.halo$setStorage) before releasing it, so the release is idempotent and no dangling address survives. The explicit release itself is kept: removing it would leak this native staging memory on every generation, because LWJGL'smemByteBufferregisters no Java-side cleaner for these buffers on 1.20.1.- The lit stream now sizes its staging buffer by the corners it actually writes.
QUADSmode writes four corners per quad while the index buffer expands to six, so sizing by index count always forced aBufferBuildergrowth, and growth reallocates throughMemoryTracker.realloc, freeing the initial block behind the wrapper's back. A new capacity regression test pins the formula. - Scope:
render/MeshUploadBuffer,render/HaloMeshBufferCacheand theBufferBuilderStorageAccessormixin only. HaloCore pin1d3cf90(2.4.2), definition schema, saves, networking, anchor API v2 and every other render path are unchanged. Minecraft 1.20.1 Fabric players still install a single Halo JAR. - Automated tests passed on this platform (core and Halo suites; the external YSM 2.6.5 signature check stays skipped without
HALO_YSM_TEST_JAR). The user reproduced the crash on the previous build and retested this one in the affected modpack; the large-mesh startup scenario no longer crashes.
Requires Java 17 or newer, and Fabric Loader 0.15.11 or newer with Fabric API.
- 修复缓存 mesh 代次准备阶段的 JVM 崩溃。1.20.1 没有
BufferAllocator/ByteBufferBuilder,上传暂存的原生内存由 Halo 自己持有;MeshUploadBuffer.close()释放了这块内存,却把地址留在BufferBuilder里,任何随后读取同一 buffer 的清理路径——ModernFix 注入的BufferBuilder.finalize会调用UnsafeBufferHelper.free——就会对同一块内存二次释放,进程在jemalloc内以EXCEPTION_ACCESS_VIOLATION结束(Finalizer线程,jemalloc.dll)。 MeshUploadBuffer.close()改为先把 buffer 从 builder 取出(新增BufferBuilderStorageAccessor.halo$setStorage)再释放,释放因此幂等,也不再留下悬垂地址。显式释放这一优化被保留:1.20.1 上 LWJGL 的memByteBuffer不会为这些缓冲注册 Java 侧清理器,删掉释放会让每代次的原生暂存内存泄漏。- lit 流改为按实际写入的角数预分配暂存容量。
QUADS模式每个四边形写四个角而索引缓冲扩展为六个,按索引数预分配必然触发BufferBuilder增长,而增长经MemoryTracker.realloc会在包装器背后释放初始块。新增容量回归测试锁定该公式。 - 改动范围仅限
render/MeshUploadBuffer、render/HaloMeshBufferCache与BufferBuilderStorageAccessormixin。HaloCore 指针1d3cf90(2.4.2)、定义 schema、存档、网络、锚点 API v2 及其余渲染路径均不变。Minecraft 1.20.1 Fabric 玩家仍只需安装一个 Halo JAR。 - 本平台自动测试通过(core 与 Halo 测试套件;未提供
HALO_YSM_TEST_JAR时外部 YSM 签名检查保持跳过)。用户已在受影响整合包中复现旧版本崩溃,并用本版本复测,大网格启动场景不再崩溃。
需要 Java 17 或更高版本,Fabric Loader 0.15.11 或更高版本,以及 Fabric API。

