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

Suggest the next multiple of 64KB when the user provides us with a memory value that isn't one #13027

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

amedeedaboville
Copy link

@amedeedaboville amedeedaboville commented Dec 12, 2020

Hi, thanks for Emscripten!

Small quality of life improvement:

This change suggests the next multiple of 64KB when the user supplies a value for INITIAL_MEMORY, MAXIMUM_MEMORY, or MEMORY_GROWTH_LINEAR_STEP that is not a multiple of 64KB:

emcc: error: For wasm, INITIAL_MEMORY must be a multiple of 64KB, was 90507904. The next highest multiple of 64KB is 90570752

@welcome
Copy link

welcome bot commented Dec 12, 2020

Thank you for submitting a pull request! If this is your first PR, make sure to add yourself to AUTHORS.

@amedeedaboville
Copy link
Author

A further idea in this vein would be to round up to 64KB the required numbers in errors like error: initial memory too small, 103062208 bytes needed to 64KB, so users could copy-paste that number without hitting the above "not a multiple of 64KB" error. I could submit that here or in a future PR.

@sbc100
Copy link
Collaborator

sbc100 commented Dec 13, 2020

I'm curious often have you, as a developer, run into this issue where this warning would be useful to you?

I'm not sure how useful this given that this is the kind of thing that:

a) folks tend to do this just once or twice per project.
b) people tend to use mb which doesn't have this problem.

I'm all for tools being helpful but I'm also really trying to keep emscripten simple/small where possible. Given the choice maybe I'd even prefer just silently rounding up and removing this error.. I'm not sure.

@amedeedaboville
Copy link
Author

Ah I didn't know you could use mb! I was in a cycle of copy-pasting the memory too small, X bytes needed value into INITIAL_MEMORY=X -> memory not a multiple of 64kb errors yesterday and wanted this, I didn't know the way to do it was to just pick a large value like 200mb and call it a day.

I agree that silently rounding up is even better, it's unlikely that someone will find themselves hurting over an extra <64KB of RAM, and it's not unexpected to round up. Plenty of our developer tools already round requested values up to boundaries and allocate more than we ask for, eg reading from disk in 4KB disk page increments.

Base automatically changed from master to main March 8, 2021 23:49
@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants