Platforms to show: All Mac Windows Linux Cross-Platform

/Images/LargePicture/PictureMBS as a big memoryblock


Required plugins for this example: MBS Util Plugin, MBS Images Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Images/LargePicture/PictureMBS as a big memoryblock

This example is the version from Sun, 17th Mar 2012.

Project "PictureMBS as a big memoryblock.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() if SystemInformationMBS.PhysicalRAM < 8000000000.0 then MsgBox "Please run this sample only if you have 8 GB of memory or more. Else your computer will swap and slow down." quit Return end if dim RecordCount as integer = 1000000 dim RecordSize as integer = 4000 // 4000*1100000 plus some alignment is 4.1 GB and more than you can normally have in a 32 bit application dim WindowSize as integer = 500000000 // 500 MB, so 120000 rows fit in memory System.DebugLog "RecordCount: "+str(RecordCount) System.DebugLog "RecordSize: "+str(RecordSize) System.DebugLog "WindowSize: "+str(WindowSize) // find a temp file on the start volume dim tempfile as FolderItem = Volume(0).Child("testfile "+str(rnd)) dim p as new PictureMBS(RecordSize, RecordCount, PictureMBS.ImageFormatG, WindowSize, tempfile) if p.Valid = false then MsgBox "Failed to allocate image." Return end if // now use it. // We get 64 KB per Row System.DebugLog "Write..." dim h as integer = p.Height-1 for i as integer = 0 to h dim m as MemoryBlock = p.RawRow(i) // pick the memory // write something there if m = nil then MsgBox "Failed to get row memory." Return end if m.StringValue(0,5)="Hello" next System.DebugLog "Write done." System.DebugLog "Read..." // now read back for i as integer = 0 to h dim m as MemoryBlock = p.RawRow(i) // pick the memory if m = nil then MsgBox "Failed to get row memory." Return end if // write something there if m.StringValue(0,5)<>"Hello" then MsgBox "Failed on row "+str(i) Return end if next System.DebugLog "Read done." MsgBox "Test OK" quit 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

See also:

The items on this page are in the following plugins: MBS Images Plugin.


The biggest plugin in space...