That 1MB allocation must have just pushed it over the top of the total
memory usage exceeding 16MB.

If you see a difference between two browsers here, it is likely either a
browser bug or a timing-related issue, as running out of memory in
emscripten is managed entirely by emscripten (we just allocate a typed
array and handle allocations inside it ourselves), not by the JS engine. In
other words, the browser's memory management should not matter. If you can
consistently reproduce the problem and can share a testcase, please file a
bug.

- Alon


On Mon, Feb 16, 2015 at 6:34 PM, Ishaan Venkatesan <
[email protected]> wrote:

> 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.
>

-- 
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