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

Error with the TOTAL_MEMORY parameter #36

Closed
stoomm opened this issue Dec 24, 2012 · 1 comment
Closed

Error with the TOTAL_MEMORY parameter #36

stoomm opened this issue Dec 24, 2012 · 1 comment

Comments

@stoomm
Copy link

stoomm commented Dec 24, 2012

Hello,

I made a rapid benchmark test file for testing performance with constraints.
When I launch the test, I've this error :

uncaught exception: Assertion: Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value ( 20971520), (2) compile with ALLOW_MEMORY_GROWTH which adjusts the size at runtime but prevents some optimizations, or (3) set Module.TOTAL_MEMORY before the program runs.

I think there an error because :

  • ammo was compiled with TOTAL_MEMORY=52428800 (50Mb), not 20Mb ( 20971520)
  • setting TOTAL_MEMORY in the source with Ammo.TOTAL_MEMORY=xxxxxxx doesn't work (always 20 Mb instead 50Mb)

File for test : http://www.stoomm.com/benchconstraint.js (lauch with test.py)

Thanks a lot for your help.

@kripken
Copy link
Owner

kripken commented Jan 3, 2013

The message was misleading about 20MB/50MB, I fixed that now.

The problem with changing Ammo.TOTAL_MEMORY is that it must be done during load of ammo.js - it is fixed at startup, and cannot be changed later (unless you build with ALLOW_MEMORY_GROWTH, which slows things down). What you can do is either (1) change in ammo.js where it says Module.TOTAL_MEMORY||52428800, altering that number will change it, or (2) add this JS code before you load ammo.js: var Module = { TOTAL_MEMORY: ... };, during startup ammo.js will look at the Module object.

I saw the test runner used to do that and set it to 20MB, which is not needed now that the default is 50MB. I removed it from the test runner now.

@stoomm stoomm closed this as completed Mar 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants