Platforms to show: All Mac Windows Linux Cross-Platform

Back to MemoryBlockMBS class.

MemoryBlockMBS.Close

Type Topic Plugin Version macOS Windows Linux iOS Targets
method memoryBlock MBS Util Plugin 5.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The destructor.

There is no need to call this method except you want to free all resources of this object now without waiting for Xojo to do it for you.

MemoryBlockMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method memoryBlock MBS Util Plugin 16.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The constructor.

This constructor does nothing, so you can call Create yourself.

See also:

MemoryBlockMBS.Constructor(Mem as MemoryBlock)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method memoryBlock MBS Util Plugin 16.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new MemoryBlockMBS with content of memoryblock.
Example
dim s as string = "Hello World"
dim m as MemoryBlock = s

dim x as new MemoryBlockMBS(m)

MsgBox str(x.Size)

Raises exception is size is invalid or no memory is available.

See also:

MemoryBlockMBS.Constructor(Mem as MemoryBlock, Size as Int64, Offset as Int64 = 0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method memoryBlock MBS Util Plugin 16.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new MemoryBlockMBS with given size and copies content of memoryblock.
Example
dim s as string = "Hello World"
dim m as MemoryBlock = s

dim x as new MemoryBlockMBS(m, 9)

MsgBox str(x.Size)

Raises exception is size is invalid or no memory is available.

See also:

MemoryBlockMBS.Constructor(Size as Int64)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method memoryBlock MBS Util Plugin 16.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new MemoryBlockMBS with given size.

Raises exception is size is invalid or no memory is available.

See also:

MemoryBlockMBS.Constructor(Str as String)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method memoryBlock MBS Util Plugin 16.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new MemoryBlockMBS with content of string.
Example
dim s as string = "Hello World"
dim x as new MemoryBlockMBS(s)

MsgBox str(x.Size)

Text encoding is ignored and bytes copied as they are.
Raises exception is size is invalid or no memory is available.

See also:

MemoryBlockMBS.Constructor(Str as String, Size as Int64, Offset as Int64 = 0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method memoryBlock MBS Util Plugin 16.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new MemoryBlockMBS with given size and copies content of string.
Example
dim s as string = "Hello World"
dim x as new MemoryBlockMBS(s, 9)

MsgBox str(x.Size)

Text encoding is ignored and bytes copied as they are.
Raises exception is size is invalid or no memory is available.

See also:

MemoryBlockMBS.Create(size as Int64) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method memoryBlock MBS Util Plugin 9.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new memoryblock.
Example
dim m as MemoryBlockMBS
dim n as MemoryBlock
dim t as Integer

const size=2200000000

// RB: up to 1 GigaByte
// Plugin: up to 2 GigaByte - 1 Byte

m=New MemoryBlockMBS

t=ticks
if m.Create(size) then
n=m.Memory

MsgBox str(ticks-t)

end if

t=ticks
n=NewMemoryBlock(size)
if n<>nil then
MsgBox str(ticks-t)
end if

Returns true on success and false on failure.
Size can be any positive value up to &h7FFFFFFF (=2^31-1).

Size became 64bit to avoid integer overflows.

MemoryBlockMBS.Resize(Size as Int64) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MemoryBlock MBS Util Plugin 9.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Tries to resize the memorybock to the new size.
Example
dim m as new MemoryBlockMBS

if m.Create(1000) then
MsgBox str(m.Size)

if m.Resize(2000) then
MsgBox str(m.Size)
end if
end if

Returns true on success.
If false is returned, the memoryblockMBS is not touched.

If the new size is smaller, data is lost as the memoryblock is cut.
If the new size is bigger, the memoryblock is resized. Or if that does not work, a new memoryblock is created and data is copied. New bytes will be zero.

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


The biggest plugin in space...