Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose memory.grow, memory.size, memory.dataLength #79

Closed
3 tasks done
ballercat opened this issue Feb 9, 2018 · 8 comments
Closed
3 tasks done

Expose memory.grow, memory.size, memory.dataLength #79

ballercat opened this issue Feb 9, 2018 · 8 comments

Comments

@ballercat
Copy link
Owner

ballercat commented Feb 9, 2018

Goal

Unblock work for a full-blown allocator.

Overview

memory_grow are not available through walt, but can be implemented as members of the Memory and Table types.

Acceptance Criteria

This should work

const memory : Memory = { initial: 1 };

function test() {
  memory.size();
  memory.grow();
  memory.dataSize();
}
  • Memory.grow()
  • Memory.size() current size of memory
  • Memory.dataSize length of the data section, always zero until data senction encoding is implemented.
@xtuc
Copy link

xtuc commented Feb 9, 2018

Just FYI WebAssembly/spec#649

@ballercat
Copy link
Owner Author

Thanks, hopefully, it only affects text encoding. Might need to adjust some docs etc.,

@poeticAndroid
Copy link

this would be nice :)

@ballercat
Copy link
Owner Author

Implemented by #148

@JobLeonard
Copy link

Not sure if this is the best place to ask, if I have a function that has to allocate a lot of memory for one operation (say I pass an unusually long array to it), but no more after that, will it keep using up all that memory?

@poeticAndroid
Copy link

yea, afaik you can't shrink memory.. if that's what you're asking..
The linear memory can only get bigger, not smaller..

@JobLeonard
Copy link

Thanks, good to know (that kind of sucks for the things that I was thinking of doing though, because it involves operations on arrays that can get quite big but only incidentally)

@poeticAndroid
Copy link

you can always reuse the memory for other stuff..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants