If you don't capture references to views, then emscripten will update
Module.HEAP8 etc. when memory grows. So only using those should be fine.

Otherwise, perhaps there should be an option to listen for memory growth
events, so that you can be notified when you need to recreate the views,
but this gets very hard with pthreads (see
https://github.com/WebAssembly/design/issues/1271 )

On Sun, Apr 7, 2019 at 1:31 PM Brian Craft <[email protected]> wrote:

> Copy overhead for large data is too high, so I'm hoping to keep the data
> in the wasm heap and provide access from js via typed array views.
>
> This seems to work well except when the heap grows, invalidating the
> views. Are there any good ways of dealing with this? I'm hoping to avoid
> putting knowledge of the invalidation all over the js code.
>
> I tried writing Proxy which delegates to a view, and updates the view as
> necessary, but using traps kills the performance of the views. E.g. every
> access, like view[i] hits the javascript trap, so iterating the view
> becomes painfully slow.
>
> --
> 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].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to