On Tue, Sep 11, 2018 at 6:34 PM, 'Kenton Varda' via v8-users
<[email protected]> wrote:
> Hi v8-users,
>
> I noticed that WASM seems to ignore the ResourceConstraints I've set on my
> isolate -- a WebAssembly.Memory object can grow to far beyond the heap
> constraint I've set, and I don't see any constraint specific to WASM. The JS
> code can, of course, specify a maximum memory limit when creating the Memory
> object, but that's an API exposed to the script. As as embedder, I need to
> enforce my own constraint.
>
> Relatedly, it appears that GetHeapStatistics() does not include WASM memory
> in the counts. As an embedder I need to keep track of the memory an isolate
> has allocated.
>
> I've searched through v8.h and haven't been able to find any alternate APIs
> for these. Is there one I missed, or is this something I'll need to add
> myself?
>
> -Kenton

You should be able to control it with the `--wasm_max_mem_pages=...`
flag (expressed in multiples of 64k) that you can set with
`v8::V8::SetFlagsFromString()`.  I don't think there is currently any
other way to configure it.

WASM allocations should be observable when you return a custom
`v8::PageAllocator*` from `v8::Platform::GetPageAllocator()`.  Maybe
not ideal but hopefully workable.

You can probably also limit memory growth that way, by returning
nullptr when it's past a threshold, although not on a per-isolate
basis.

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" 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