Platforms to show: All Mac Windows Linux Cross-Platform

FileMappingMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Filemapping and Shared Memory MBS Util Plugin 10.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The class for file mapping and shared memory access.

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.

This class has no sub classes.

Some properties using for this class:

Some examples using this class:

Blog Entries

Xojo Developer Magazine

Release notes

  • Version 21.0
    • Improved FileMappingMBS class to do >2 GB big shared memory views on 64-bit systems.
  • Version 18.3

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


FileListMBS   -   FileMappingViewMBS


The biggest plugin in space...