diff --git a/cocos/spine/lib/spine-core.d.ts b/cocos/spine/lib/spine-core.d.ts index 6bcf725f17e..a1c3eb44893 100644 --- a/cocos/spine/lib/spine-core.d.ts +++ b/cocos/spine/lib/spine-core.d.ts @@ -1214,6 +1214,7 @@ declare namespace spine { class wasmUtil { static spineWasmInit(): void; static spineWasmDestroy(): void; + static freeStoreMemory(): void; static queryStoreMemory(size: number): number; static querySpineSkeletonDataByUUID(uuid: string): SkeletonData; static createSpineSkeletonDataWithJson(jsonStr: string, atlasText: string): SkeletonData; diff --git a/cocos/spine/skeleton-data.ts b/cocos/spine/skeleton-data.ts index d872fd1ccc2..4be051a4c7b 100644 --- a/cocos/spine/skeleton-data.ts +++ b/cocos/spine/skeleton-data.ts @@ -223,6 +223,7 @@ export class SkeletonData extends Asset { wasmMem.set(rawData); this._skeletonCache = spine.wasmUtil.createSpineSkeletonDataWithBinary(byteSize, this._atlasText); spine.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache, uuid); + spine.wasmUtil.freeStoreMemory(); } return this._skeletonCache; diff --git a/native/cocos/editor-support/spine-wasm/spine-type-export.cpp b/native/cocos/editor-support/spine-wasm/spine-type-export.cpp index ac34fbc3f01..77e006afbed 100644 --- a/native/cocos/editor-support/spine-wasm/spine-type-export.cpp +++ b/native/cocos/editor-support/spine-wasm/spine-type-export.cpp @@ -1383,6 +1383,7 @@ EMSCRIPTEN_BINDINGS(cocos_spine) { .class_function("spineWasmInit", &SpineWasmUtil::spineWasmInit) .class_function("spineWasmDestroy", &SpineWasmUtil::spineWasmDestroy) .class_function("queryStoreMemory", &SpineWasmUtil::queryStoreMemory) + .class_function("freeStoreMemory", &SpineWasmUtil::freeStoreMemory) .class_function("querySpineSkeletonDataByUUID", &SpineWasmUtil::querySpineSkeletonDataByUUID, allow_raw_pointers()) .class_function("createSpineSkeletonDataWithJson", &SpineWasmUtil::createSpineSkeletonDataWithJson, allow_raw_pointers()) .class_function("createSpineSkeletonDataWithBinary", &SpineWasmUtil::createSpineSkeletonDataWithBinary, allow_raw_pointers())