hainsdominic opened issue #4178:
Greetings,
Is there a way of knowing how many pages a wasm program used during its execution? I did not find references to this on the documentation. Would it be possible to use the data method of the Store in order to do this?
Thanks!
alexcrichton commented on issue #4178:
For this you can use the
ResourceLimiter
trait combined withStore::limiter
to sum up all memories grown within aStore
. That will indicate memory that wasm had accessible but not necessarily the memory that wasm used (e.g. reserved address space but it it may not all be paged in by the OS). If you're curious about actual page usage you'd need to get the actualMemory
object to use APIs likemincore
to see if it's actually paged in.
alexcrichton commented on issue #4178:
I think this is solved with what I mentioned above so I'm going to close this, but if it doesn't work for you feel free to reopen and we can try to continue helping.
alexcrichton closed issue #4178:
Greetings,
Is there a way of knowing how many pages a wasm program used during its execution? I did not find references to this on the documentation. Would it be possible to use the data method of the Store in order to do this?
Thanks!
hainsdominic commented on issue #4178:
Thank you! I'll try to implement it soon
hainsdominic commented on issue #4178:
Would
memory.data_size
work in this use case?
hainsdominic edited a comment on issue #4178:
Would
memory.data_size
work in this use case? It seems like a simpler implementation than using the trait and the limiter. But correct me if I'm wrong.
alexcrichton commented on issue #4178:
Yes if you have access to the
Memory
then thedata_size
reported will be the size of memory that wasm was allowed to use.
Last updated: Dec 23 2024 at 12:05 UTC