RAMStreamMBS: CreateRamStreamMBS

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

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.


💬 Ask a question or report a problem