Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Main/Crash on Out of Memory
This example is the version from Sun, 17th Mar 2012.
Project "Crash on Out of Memory.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open()
InstallSystemExceptionHandlerMBS
// the following code will crash because it runs out of memory:
dim sa(-1) as string
dim ma(-1) as MemoryBlock
const m = 30000000
redim sa(m)
redim ma(m)
dim t as string = "Hello World. This is a text."
for i as integer = 1 to M
dim x as MemoryBlock = t
t = x
sa.Append t
ma.append x
next
MsgBox "OK."+EndOfLine+EndOfLine+"You can now close window to see if memory cleanup works."
End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project
The items on this page are in the following plugins: MBS Main Plugin.