|Type||Topic||Plugin||Version||macOS||Windows||Linux||Console & Web||iOS|
|class||Filemapping and Shared Memory||MBS Util Plugin||10.5||Yes||Yes||Yes||Yes||No|
FilemappingMBS is a clever way to map the content of a file into memory without loading it.
All applications are today loaded via mapping using the virtual memory manager. So your data is inside the file but some memory is used to cache it and you can access it as a memoryblock.
You can use this class in several ways:
1. file mapping read/write: Call the constructor with a file, open the file mapping and map memory in your process to read or write a file.
2. file mapping read/write with temporary files: You can create (multi gigabyte) tempory memory storage to store data too big for your application own address space.
3. a variant of 2 is to pass nil to the constructor on Windows to have the data stored in the swap files.
4. use Constructor without paramaters and call CreateSharedMemory to create a shared memory object.
5. use Constructor without paramaters and call OpenSharedMemory to access a shared memory object from another process.
For shared memory objects, be careful how you design it. Your shared memory should have a flag for editing, so one app does not edit while another app edits. Add a version value to check your application versions. Also add a value for the revision of the content so your apps can see modifications. Finally your app should handle the possibility that the application crashes while writing data. So the data can be in a bad state.
- 9 properties
- 11 methods
- method CloseFile
- method CloseFileMapping
- method Constructor
- method Constructor(file as folderitem, write as boolean = false)
- method CreateSharedMemory(name as string, Size as Int64) as boolean
- method EnlargeFile(Size as Int64)
- method MapView(mem as MemoryBlock, offset as Int64, Size as Int32) as FileMappingViewMBS
- method MapView(offset as Int64, Size as Int32) as FileMappingViewMBS
- method OpenFileMapping(MaxSize as Int64 = 0) as boolean
- method OpenSharedMemory(name as string) as boolean
- method ShrinkFile
- 4 shared methods
This class has no sub classes.
Some properties using for this class:
- FileMappingViewMBS.Parent as FileMappingMBS
Some examples which use this class:
- /Util/Filemapping/Filemapping Example
- /Util/Filemapping/Huge Temp Storage
- /Util/Filemapping/Shared Memory Client
- /Util/Filemapping/Shared Memory Server
- /Util/Shared Memory
- MBS Xojo Plugins, version 18.3pr5
- MBS Real Studio Plugins, version 13.1pr15
- MBS Real Studio Plugins, version 11.3pr14
- MBS REALbasic Plugins, version 10.5pr4
The items on this page are in the following plugins: MBS Util Plugin.
MBS Xojo PDF Plugins