Currently the only way to load a bundle from a ArrayBuffer
object is through the use of blob URL. However this can cause memory leaks especially for large game files. Blob URLs created by URL.createObjectURL
are duplicated from the original ArrayBuffer
and stored in memory until URL.revokeObjectURL
is invoked.
The workaround I used at this moment:
const url = URL.createObjectURL(new Blob([arrayBuffer], { type: "application/octet-stream", endings: "native" }));
Dos(frame, {
onEvent: (e) => {
if (e === "emu-ready")
URL.revokeObjectURL(url);
},
url: url,
theme: "light",
...
});