Remove the JBig2CCITTFaxWasmImage instance when running clean-up

This follows the same pattern as the existing handling for the `JpxImage` instance.
This commit is contained in:
Jonas Jenwald 2026-03-06 11:50:24 +01:00
parent a4fcd830cc
commit 29362e6afb

View File

@ -16,6 +16,7 @@
import { clearPatternCaches } from "./pattern.js";
import { clearPrimitiveCaches } from "./primitives.js";
import { clearUnicodeCaches } from "./unicode.js";
import { JBig2CCITTFaxWasmImage } from "./jbig2_ccittFax_wasm.js";
import { JpxImage } from "./jpx.js";
function clearGlobalCaches() {
@ -23,8 +24,9 @@ function clearGlobalCaches() {
clearPrimitiveCaches();
clearUnicodeCaches();
// Remove the global `JpxImage` instance, since it may hold a reference to
// the WebAssembly module.
// Remove the global `JBig2CCITTFaxWasmImage`/`JpxImage` instances,
// since they may hold references to the WebAssembly modules.
JBig2CCITTFaxWasmImage.cleanup();
JpxImage.cleanup();
}