WP8 - Out of memory on Image load, discard
Monkey Forums/Monkey Bug Reports/WP8 - Out of memory on Image load, discard
| ||
I've been having problems with my game explicitly on Windows Phone 8, suspecting that I am running out of memory due to graphics resources not being cleaned up after images are discarded. I decided to put together a small app to test: This runs indefinitely on glfw, desktop targets with no impact on memory. When I run it on a WP8 emulator (WVGA 512MB) I get to around 570 images allocated and discarded, then it crashes. I'm getting the following output in Visual Studio: The thread 0xa38 has exited with code 0 (0x0). First-chance exception at 0x7705277C in MonkeyGame.exe: Microsoft C++ exception: _com_error at memory location 0x013AE574. First-chance exception at 0x7705277C in MonkeyGame.exe: Microsoft C++ exception: _com_error at memory location 0x013AE9B0. ... Omitted ~50 additional entries the same as above First-chance exception at 0x7705277C in MonkeyGame.exe: Microsoft C++ exception: _com_error at memory location 0x013AEAEC. D3D11: Removing Device. It seems discarded images are retaining their allocated memory... Are we aware of a fix for this? I originally posted this on the Windows8 forum and got a few replies indicating that it is a GC issue Ste, Binary Itch |
| ||
Tried it with bananas/horsey/bg.png as testimage and it's still going OK after 5000 loads (about 1/2 an hour). I'll leave it going over lunch, but it looks pretty solid to me. Are you using the latest version of Monkey? Can you email me your testpic.png? |
| ||
Just thought I'd add this. Using the example BinaryItch posted in his thread it bombs out at 125 loads. Tested on a Lumia 635. Using Monkey Pro 82b WinPhone 8.1 Import mojo Function Main() New ImageLoadTest() End Class ImageLoadTest Extends App Private Field testImage:Image Private Field imageLoadCounter:Int Public Method OnCreate() SetUpdateRate(60) testImage = Null imageLoadCounter = 0 End Public Method OnUpdate() ' Load testImage.png every second frame ' Discard testImage.png every other frame If (testImage) testImage.Discard() testImage = Null Else testImage = LoadImage("testImage.png", 1, Image.MidHandle) imageLoadCounter += 1 EndIf End Public Method OnRender() Cls() SetColor(0, 255, 0) DrawText("Image load count: " + imageLoadCounter, 0, 10) End End GC_REMOVE_NODE( p ); 6A73EE78 ldr r3,[sp,#p] 6A73EE7A adds r1,r3,#4 6A73EE7C ldr r3,[sp,#p] 6A73EE7E adds r3,r3,#8 6A73EE80 ldr r3,[r3] 6A73EE82 adds r2,r3,#4 6A73EE84 ldr r3,[r1] 6A73EE86 str r3,[r2] <<<<<<<<<<<<<<<<<<Points Here 6A73EE88 ldr r3,[sp,#p] 6A73EE8A add r1,r3,#8 6A73EE8E ldr r3,[sp,#p] 6A73EE90 adds r3,r3,#4 6A73EE92 ldr r3,[r3] 6A73EE94 add r2,r3,#8 6A73EE98 ldr r3,[r1] 6A73EE9A str r3,[r2] |
| ||
Hi Mark, Yeah I'm using the latest version of Monkey. I've just emailed you the testImage that I'm using this morning. Cheers |
| ||
Well, I still can't get it to crash! Have tried the new testImage; debug/release configs; latest stable version, v81b; emulator/htc 8S device - and it hasn't crashed once. The 'discard' code itself looks fine, so I'm not sure what to try next. (note: I'm using msvc2013 express to build). |
| ||
It appears the project I was working on was referencing a significantly older version of Monkey to the version I'm running locally. I've run the test on the latest version and it's working fine. Just hit 20,000 allocations and discards. Thanks for the help. |