On Thu, Jan 30, 2020 at 8:11 PM Shawn Riordan <[email protected]> wrote:
> The first answer to this question: > > https://stackoverflow.com/questions/46748572/how-to-access-webassembly-linear-memory-from-c-c > > describes how to take a global buffer in wasm and expose it as a typed > array in javascript. > Where both the js and the cpp code and have random access to the same > buffer. > > Is there any volatility to the scope of the typed array? > Fortunately, JS threading model is single threaded, so there's no other thread to change it. There are SharedArrayBuffers which can pass to worker threads, and have no volatile protection themselves. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer 'Updating and synchronizing shared memory with atomic operations' > What if the connection was made at the beginning of a session and kept > throughout the lifetime of the program? > Would any memory end up being jostled about in the wasm that would cause > the memory address to change? > > I can't really answer this; like what happens when the heap needs to expand, but am curious if maybe there's a on-heap-change event that could be registered/handled. Currently, I am passing an array of floats back and forth on a regular > basis. Lots of mallocs and frees. > It is attractive to me, to just do it once. And so far, it works great. > But I am just wondering if there could be issues down the road. > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/0df49606-82e9-4b02-bc44-83e7df70a1da%40googlegroups.com > <https://groups.google.com/d/msgid/emscripten-discuss/0df49606-82e9-4b02-bc44-83e7df70a1da%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAA2GJqUecc-B3Q0hmb5BgUEOFpPB6UMR3a_vLVsz%3D99W5ja9HQ%40mail.gmail.com.
