Dynamically allocate large WASM G-code sources

This commit is contained in:
2026-08-30 14:20:48 +08:00
parent a72971129a
commit 1a92d3b5b8
4 changed files with 75 additions and 12 deletions

View File

@@ -271,5 +271,11 @@ export class WasmProgramRuntime {
} finally { this.core._free(buffer); }
}
destroy() { for (const pointer of [this.pointer, this.motionPointer, this.samplePointer, this.samplePosePointer]) if (pointer && typeof this.core?._free === "function") this.core._free(pointer); this.pointer = this.motionPointer = this.samplePointer = this.samplePosePointer = 0; this.executionSource = ""; this.executionLines = []; }
destroy() {
if (this.pointer && (typeof this.core?._sim_program_destroy === "function" || typeof this.core?.sim_program_destroy === "function")) call(this.core, "sim_program_destroy", "number", ["number"], [this.pointer]);
for (const pointer of [this.pointer, this.motionPointer, this.samplePointer, this.samplePosePointer]) if (pointer && typeof this.core?._free === "function") this.core._free(pointer);
this.pointer = this.motionPointer = this.samplePointer = this.samplePosePointer = 0;
this.executionSource = "";
this.executionLines = [];
}
}