WASM: Cannot enlarge memory arrays.
I get this error when I am trying to do some complex c# foreach loops and recursion. Did not see anywhere that I can add any of these settings.
WASM: Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 2147352576, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0
Can you please post a minimal repro?
Blazor's build of the Mono WebAssembly runtime does have the ALLOW_MEMORY_GROWTH=1 flag. Is it possible you're doing something extremely nonstandard with a custom build of Mono WebAssembly?
If not, we'd really need a repro case to be able to investigate. Maybe there's some totally unrelated bug that's getting reported in a strange way.
I had similar issue and the reason was a recursive/infinite loop due to a property's set calling itself and adding bunch of elements in a list in each recursion.
On Thu, Jun 28, 2018, 2:09 PM Steve Sanderson [email protected] wrote:
Can you please post a minimal repro?
Blazor's build of the Mono WebAssembly runtime does have the ALLOW_MEMORY_GROWTH=1 flag. Is it possible you're doing something extremely nonstandard with a custom build of Mono WebAssembly?
If not, we'd really need a repro case to be able to investigate. Maybe there's some totally unrelated bug that's getting reported in a strange way.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/aspnet/Blazor/issues/1045#issuecomment-400958460, or mute the thread https://github.com/notifications/unsubscribe-auth/ACnwPw8mOKbYt19sEGtembsSqSA4d_uAks5uBJYvgaJpZM4U5MEH .
Okay, I will post my code when I get a chance. Actually this code was originally in tyescript and I just ported it to c#, so I will post both version so you can see both and maybe I missed something.
Thanks,
Just a minimal (short) C# repro will be relevant, thanks!
Here is the code on github to help resolove this issue. The issue occurs when:
- You launch the site, and click on the first image on the landing page
- click on the third button (under the text "Warn...") and a modal should pop up.
- click a radio button and then hit the select button and in the console you will see the error
https://github.com/phanronald/KawasakiReproject/tree/AXBuilder/KawasakiReproject/AxBuilder
@phanronald Thanks for posting. If you want to track this down, I'd suggest:
- Figure out exactly which line of code is running immediately before the error occurs. Since it's not currently possible to attach a debugger to .NET running on Mono WebAssembly (though we're working on that!), the best way is to put a series of
Console.WriteLinecalls in different places to find out how far the execution is progressing. - When you have determined exactly which bit of code triggers the error, recreate the error in a clean new project as a minimal block of standalone code that produces it. Hopefully you can reduce it down to 10-20 lines or less.
- At that point, there's a good chance you'll realise there was some bug in the application code causing it to allocate memory infinitely, or something like that
- Or if at that point you believe your repro code should be valid and in fact there's a bug in Blazor or Mono, please post that minimal standalone repro code (not an entire project) and we'll be happy to have a look
Hope that's OK and makes sense. Please let us know whether you plan to undertake this investigation. If so we'll leave the issue open for a short while.
@SteveSandersonMS you are right there was an infinite loop, sorry for the trouble. Thanks,
Thanks for confirming.