My application allocates a number of windows, by setting Glide.MainWindow. After showing about 5 new windows, I get an out of memory exception. I tried calling Glide.MainWindow.Dispose() but that throws a Dispose exception. Is there any way to force Glide to release its bitmap from the custom heap before creating a new window?
If there is no way around it Glide is open source. You can change/fix the behavior and recompile the assembly.
Tinkr is also now open source (search the forum) and I’m working on a version 2 of Glide, though it is currently unnamed per GHI
@ dspacek - If you create a small program for us that shows the out of memory exception, we can take a look and see if things can be improved.
@ John - I am having the problem on a Cobra II board. Can you still test a program on a Cobra II board?
@ dspacek - Yes I can still test on a Cobra II.
@ John - I made a small test program using only Glide, and now there is no problem, so the bug lies somewhere else. Glide used up memory, but it always came back. Before the out of memory exception, I see “Failed Allocation” a few times in a GC report. Not sure what to do. Maybe I will put in calls Debug.Print(GC(false)) in some places, comment out code until the problem stops.
@ dspacek - You’ll see failed allocation messages even if you don’t see an out of memory exception. When a bitmap is created, if there is not enough memory available, NETMF runs the GC to compact the memory. It then tries again. Only if it still doesn’t have enough memory will you see the exception.
Your best bet is to disable parts of your program until the error disappears and repeat with smaller parts to try and narrow down the cause.