Platforms to show: All Mac Windows Linux Cross-Platform

Back to RAMStreamMBS class.

CreateRamStreamMBS(InitialSize as Integer = 0) as RamStreamMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method RAMStream MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new RAMStream.
Example
dim r as RAMStreamMBS
r=CreateRamStreamMBS(1000000)
r.write "Hello"

To avoid memory fragmentation the memory grows in 32 KByte chunks.

The parameter you give is the size for the first allocation. So if you only need 2 KByte, you just pass 2048. If you don't know the size, you can pass 0 or a negative number to get the default initial size which is 32 KByte.

You can change the GrowSize property to use a different growing size.
Performance is better if resizing the memory buffer is minimized.

The stream can grow to around 2 GB.
Returns nil on low memory.

Some examples using this global method:

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


The biggest plugin in space...