Main Site Documentation

FEZ SPIDER Custom heap


#1

I’m getting a systemOutofrange exception on my fez spider. I think is the custom heap. How can i fix this since the custom heap is fixed?

I am using glide and the cp7 module.


#2

Yes.

 
_window1.LoadWindow(Resources.GetString(Resources.StringResources.Window1));
            _window2.LoadWindow(Resources.GetString(Resources.StringResources.Window2));
            _window3.LoadWindow(Resources.GetString(Resources.StringResources.Window3));
            _window4.LoadWindow(Resources.GetString(Resources.StringResources.Window4));
            _window5.LoadWindow(Resources.GetString(Resources.StringResources.Window5)); //here is where is get the error

            _window2.ButtonPressed += Window2ButtonEvent;
            _window3.ButtonPressed += Window3ButtonEvent;
            _window4.ButtonPressed += Window4ButtonEvent;

            Persons = 1;

            SetMainWindow(_window1.ThisWindow);
            GlideTouch.Initialize();
            Glide.FitToScreen = true;

im using 5 glide windows and when the last window is initialized (loaded) i get this error:

GC: performing heap compaction…
#### Exception System.OutOfMemoryException - CLR_E_OUT_OF_MEMORY (1) ####
#### Message:
#### Microsoft.SPOT.Bitmap::.ctor [IP: 0000] ####
#### GHIElectronics.NETMF.Glide.Display.Graphics::.ctor [IP: 000c] ####
#### GHIElectronics.NETMF.Glide.Display.Window::.ctor [IP: 003b] ####
#### GHIElectronics.NETMF.Glide.GlideLoader::ParseWindow [IP: 0076] ####
#### GHIElectronics.NETMF.Glide.GlideLoader::LoadWindow [IP: 009f] ####
#### GHIElectronics.NETMF.Glide.GlideLoader::LoadWindow [IP: 000b] ####
#### Trinit.GadgeteerProject.NQuire.WindowFive::LoadWindow [IP: 0006] ####
#### Trinit.GadgeteerProject.NQuire.Program::ProgramStarted [IP: 0084] ####
A first chance exception of type ‘System.OutOfMemoryException’ occurred in Microsoft.SPOT.Graphics.dll
An unhandled exception of type ‘System.OutOfMemoryException’ occurred in Microsoft.SPOT.Graphics.dll

if i comment a window it works fine, so i think the fifth window is to much for the heap to take.


#3

You can’t have many windows in memory simultaneously. Only keep in memory what you need and dispose the rest.

800x600x2 = about 1MB for each window.