X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-java;a=blobdiff_plain;f=typescript_strings.py;h=0d9f30b81b2293f09acb7b45f00745330e04f1a1;hp=7d63af91a69f405765cdfd67c54fb31eea1c07c4;hb=6108d1a32ba0b434521d3f0d9e4176c4d12de25b;hpb=03aa3308e672027e8a0be8365a7fc13e195a5c67 diff --git a/typescript_strings.py b/typescript_strings.py index 7d63af91..0d9f30b8 100644 --- a/typescript_strings.py +++ b/typescript_strings.py @@ -207,6 +207,9 @@ const decodeUint32Array = (arrayPointer: number, free = true) => { return actualArray; } + +export function freeWasmMemory(pointer: number) { wasm.TS_free(pointer); } + /* @internal */ export function getU32ArrayElem(arrayPointer: number, idx: number): number { const actualArrayViewer = new Uint32Array(wasm.memory.buffer, arrayPointer + 4, idx + 1); @@ -635,6 +638,8 @@ import * as bindings from '../bindings.mjs' assert False def constr_hu_array(self, ty_info, arr_len): return "new Array(" + arr_len + ").fill(null)" + def cleanup_converted_native_array(self, ty_info, arr_name): + return "bindings.freeWasmMemory(" + arr_name + ")" def primitive_arr_from_hu(self, mapped_ty, fixed_len, arr_name): inner = arr_name