cross-posted from: https://programming.dev/post/9220472
Iβve just had this happen (and then stop again) for the second time in a few weeks. This is a new MAUI app where the only thing Iβve changed so far, other than add a few of my own (already previously tested and working) libraries, is change the home page, and the new home page only has a couple of labels on it, so it has no complexity at all added to it yet, and yet getting this odd alleged memory issue. The first time it happened I couldnβt find a fix for it, left it for a while, came back (a weekβs worth of reboots later) and it was working again. Then today I made one trivial change - added a debug write - and the problem came back (but got past the new line without any issues). Then I rebooted and itβs working again.
I have 32Gb of RAM, with 12Gb allocated to a RAMdisk, and I have my paging files set to use the RAMdisk.
It generated a log file which saidβ¦
βNative memory allocation (mmap) failed to map 186646528 bytes for G1 virtual spaceβ
β¦so it only needed 180Mb, and down near the bottom it saysβ¦
βMemory: 4k page, system-wide physical 32579M (3638M free)β
β¦so I had more than enough space left (so the memory message may be a red herring for whatever did cause the crash). Googling that first message brings up a bunch of matches, but none of which are for MAUI Android (all different cases with different fixes).
This is using the Android emulator on a Windows machine where Iβve set the paging sizes to be system-managed. Iβm not sure where the Android emulator actually gets memory from though - the system RAM? The paging RAM(disk)? The build directory? The userβs App directory?
It reminds me of years ago there was a similar issue with Xamarin Android where the fix/workaround was to add a line to the csproj (I think it increased the heap or something from memory), but I havenβt seen that pop up in a long time. Not sure if this is the same issue or a different one.
Thereβs no repro for it cos I canβt even reliably repro it. Iβm just concerned that itβs going to keep coming back given I havenβt even added any complexity to it yet.
Has anyone run into this and/or knows how to fix it?
Iβm building up quite a collection of these, so itβs far from being a once-off issue. In other words, Iβm still looking for any ideas on how to fix this
Iβve just had this happen again, and the Android emulator failed to start in the first place. I looked at my RAM usage, and it was at 83%. That includes my RAMdisk (which was at 20% usage itself). I tried to run the app again (without a reboot, which has fixed it in the past), and it happened again, but my RAM usage never went up, so it definitely never hit 100% (which I knew already from the logs, but now confirmed with Task Manager). Still no idea why this is happenning.
P.S. why on Earth are some of you downvoting this? This is a legit MAUI issue which only happens when I try to run the app on my Android emulator on a Windows device, and Iβm trying to find a solution.