From Xojo Documentation

Revision as of 18:53, 19 November 2009 by WikiSysop (talk) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Raised in certain cases when you run out of memory.

Super Class

RuntimeException class.


The OutOfMemoryException error may be raised when an operation cannot be completed due to insufficient memory. It is difficult to say when this may occur, especially since all operating systems supported by REALbasic use dynamic memory allocation. One possibility is when you are attempting to load a large graphics file into memory.


This example uses the Catch statement in a window's Open event handler to handle out of memory exceptions when trying to draw an imported gif image. The variable myPicture is a global property of type Picture. The picture "Logo" has been added to the Project Editor.

Sub Open
 myPicture=New Picture(Logo.width,Logo.height,32)
 myPicture.Graphics.DrawPicture Logo,0,0

Catch err as OutOfMemoryException 
MsgBox "Insufficient memory to draw the picture!"

See Also

RuntimeException class; Function, Raise statements; Nil datatype; Exception, Try statements.