I'd like to send a data pointer to a JS function at a very high rate (in order to render it on a canvas). What is the best way to do this with Emscripten, without copying the actual data ?
Is the following correct?
void send(void const * data, unsigned length) {
EM_ASM({
var data = new Uint8Array(HEAP8.buffer, $0, $1);
Module.send();
}, data, length);
}
The issue is that it requires an Uint8Array allocation at each frame, which will not make the garbage collector very happy... :(