The include files memory.bi/.bm do implement a system, which allows to use
and address a big dimensioned numeric array as one continuous region of
memory for your general purpose usage. You can allocate blocks from this
memory region to store whatever data you want in it, later on you can also
free the blocks which are not longer needed to allow them to get re-used
for further allocations. It's a complete memory management and allocator
system local to your program.
Nevertheless of the nature of this system, there are no DEFSEG, VARSEG,
VARPTR, _OFFSET or _MEM operations invoked, the system is operated only
via the array indices. That is, there are no low level accesses to the
real underlying memory, hence the entire system runs safe within the QB64
environment.
The system manages all of the free memory currently available in the array.
Using linked list structures, it keeps track of the memory and provides the
functions to allocate and access it. In the following discussion this system
is referred to as GPM or GP Memory, where the GP is for "General Purpose".
GP Memory Functions
-------------------
SUB InitGPMem (maxSize&, flags&)
SUB DumpGPMem (file$, flags&)
FUNCTION AvailGPMem& (flags&)
FUNCTION AllocGPMem& (getSize&, flags&)
FUNCTION AllocGPMVec& (getSize&, flags&)
SUB FreeGPMem (addr&, freeSize&)
SUB FreeGPMVec (addr&)
FUNCTION CreateGPMString& (text$)
SUB DisposeGPMString (mstr&)
FUNCTION AlignGPMSize& (size&)
SUB FillGPMem (addr&, size&, byteVal%%)
FUNCTION CompareGPMem& (sAddr&, cAddr&, size&, flags&)
SUB CopyGPMem (sAddr&, dAddr&, size&)
SUB PokeXX (addr&, offs&, value) 'XX is just a type placeholder here
FUNCTION PeekXX (addr&, offs&) 'XX is just a type placeholder here
In these functions, xxxSize& usually represents a size value given in bytes,
xAddr& represents an address pointer (type DefGPMPTR (types.bm)) as returned
by the allocation functions, and offs& is either zero or a byte offset which
will be added to the given address. Other arguments are discussed later.
Initializing GP Memory
Debugging Support
Query GP Memory
Allocating GP Memory
Freeing GP Memory
Support Functions
Accessing GP Memory
Function Reference
Back to RSI-Docs