**Full Changelog**: [Here](https://github.com/AzusaKe/Halo/compare/v2.4.2-forge-1.20.1-adapter.2...v2.4.2-forge-1.20.1-adapter.3)
---
- 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 in `BufferBuilder`, so any later cleanup path reading the same buffer - ModernFix injects a `BufferBuilder.finalize` that calls `UnsafeBufferHelper.free` - freed the same memory a second time and killed the process inside `jemalloc` with an `EXCEPTION_ACCESS_VIOLATION` (`Finalizer` thread, `jemalloc.dll`). The bundled 1.20.1 modpack reproduced this on three consecutive launches with `hs_err_pid*.log` reports at `jemalloc.dll+0x15f8f`.
- `MeshUploadBuffer.close()` now takes the buffer out of the builder (new `BufferBuilderStorageAccessor.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's `memByteBuffer` registers 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. `QUADS` mode writes four corners per quad while the index buffer expands to six, so sizing by index count always forced a `BufferBuilder` growth, and growth reallocates through `MemoryTracker.realloc`, freeing the initial block behind the wrapper's back. A new capacity regression test pins the formula.
- Scope: `render/MeshUploadBuffer`, `render/HaloMeshBufferCache` and the `BufferBuilderStorageAccessor` mixin only. Forge 1.20.1 specifics stay what they were (Mojang official mappings, `getVertexSize()`, `VertexFormat.Mode`). HaloCore pin `1d3cf90` (2.4.2), definition schema, saves, networking, anchor API v2, the adapter 2 YSM fix and every other render path are unchanged. Minecraft 1.20.1 Forge players still install a single Halo JAR.
- Automated tests passed on this platform (core and Halo suites, flat core packaging and provenance, Forge API v2 consumer, legacy anchor API; external EMF/YSM signature checks stay skipped without their external JARs). 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, Forge 47.4.0 or newer (Minecraft 1.20.1).
---
- 修复缓存 mesh 代次准备阶段的 JVM 崩溃。1.20.1 没有 `BufferAllocator`/`ByteBufferBuilder`,上传暂存的原生内存由 Halo 自己持有;`MeshUploadBuffer.close()` 释放了这块内存,却把地址留在 `BufferBuilder` 里,任何随后读取同一 buffer 的清理路径——ModernFix 注入的 `BufferBuilder.finalize` 会调用 `UnsafeBufferHelper.free`——就会对同一块内存二次释放,进程在 `jemalloc` 内以 `EXCEPTION_ACCESS_VIOLATION` 结束(`Finalizer` 线程,`jemalloc.dll`)。整合包在连续三次启动中均复现,并留下 `hs_err_pid*.log`(崩溃点固定在 `jemalloc.dll+0x15f8f`)。
- `MeshUploadBuffer.close()` 改为先把 buffer 从 builder 取出(新增 `BufferBuilderStorageAccessor.halo$setStorage`)再释放,释放因此幂等,也不再留下悬垂地址。显式释放这一优化被保留:1.20.1 上 LWJGL 的 `memByteBuffer` 不会为这些缓冲注册 Java 侧清理器,删掉释放会让每代次的原生暂存内存泄漏。
- lit 流改为按实际写入的角数预分配暂存容量。`QUADS` 模式每个四边形写四个角而索引缓冲扩展为六个,按索引数预分配必然触发 `BufferBuilder` 增长,而增长经 `MemoryTracker.realloc` 会在包装器背后释放初始块。新增容量回归测试锁定该公式。
- 改动范围仅限 `render/MeshUploadBuffer`、`render/HaloMeshBufferCache` 与 `BufferBuilderStorageAccessor` mixin。Forge 1.20.1 的映射差异(Mojang official mapping、`getVertexSize()`、`VertexFormat.Mode`)保持原样。HaloCore 指针 `1d3cf90`(2.4.2)、定义 schema、存档、网络、锚点 API v2、adapter.2 的 YSM 修复及其余渲染路径均不变。Minecraft 1.20.1 Forge 玩家仍只需安装一个 Halo JAR。
- 本平台自动测试通过(core 与 Halo 测试套件、扁平化 core 打包与来源校验、Forge API v2 调用方、旧锚点 API;缺少外部 EMF/YSM 包时其签名检查保持跳过)。用户已在受影响整合包中复现旧版本崩溃,并用本版本复测,大网格启动场景不再崩溃。
需要 **Java 17** 或更高版本,Forge 47.4.0 或更高版本(Minecraft 1.20.1)。
Developer information
Projects on Modrinth are automatically available through a Maven repository for use with JVM build tools such as Gradle.
maven { name = "Modrinth"; url = "https://api.modrinth.com/maven" }