Today I ran into the following exception after allocating an 
std::vector<char> of size 718924 in C++. The exception said,

"Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X 
with X higher than the current value 16777216, (2) compile with 
ALLOW_MEMORY_GROWTH which adjusts the size at runtime but prevents some 
optimizations"

Although I was able to fix the exception by setting "-s 
ALLOW_MEMORY_GROWTH=1" flag, it is still surprising that a memory block of 
less than 1M would cause the exception in the first place. In addition, I 
would prefer not to use ALLOW_MEMORY_GROWTH in order to maximize 
performance.

Interestingly, when I turned on "ALLOW_MEMORY_GROWTH" flag, the Chrome 
browser was able to handle the large array correctly, but IE9 threw the 
same exception. 

Any thoughts on the cause of these problems?

Thanks for your thoughts!

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" 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