Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I receive a "Out of Windows Resources" warning when I open numerous figure windows in MATLAB [7.0 (R14) and beyond] on a Microsoft Windows PC?

Tags:

matlab

My screen resolution is set to 1600x1200. In MATLAB, I set my "DefaultFigurePosition" property using the following command:

set(0,'DefaultFigurePosition', [400 100 1050 1000])

I then open multiple figure windows using the following loop:

for i = 1:46
    figure
end

On the last figure, I receive the following message in the command window:

    Out of Windows Resources: Allocation of bitmap failed.  
Disabling backingstore for current figure.
like image 884
MatlabDoug Avatar asked Jun 03 '09 14:06

MatlabDoug


2 Answers

Unfortunally, Windows has a limited number of graphics resources.

You can check the number of resources using the Task Manager, at the tab Processes, clicking the menu View/Select Columns and mark the "GDI objects" option.

Then you can see the number of graphics objects (GDI) used by each process.

The maximum amount of GDI objects per process is roughly 9900 objects. With more than that the process will not be able to draw them correctly.

like image 21
Paulo Santos Avatar answered Nov 16 '22 01:11

Paulo Santos


One way to avoid this message is to reduce the default figure size, specified by the third and fourth elements of the "DefaultFigurePosition".

Also, you can try increasing Java VM heap space as described in the following Technical Solution "How do I increase the heap space for the Java VM in MATLAB 6.0 (R12) and later versions?" at:

http://www.mathworks.com/support/solutions/en/data/1-18I2C/

Also, sometimes, changing the renderer to opengl might work. This can be done as following:

set(h,'Renderer','opengl');
like image 75
MatlabDoug Avatar answered Nov 16 '22 00:11

MatlabDoug