Allocate global memory in GFA -Code and info from Ulli Gruszka, Thomas Binder and Lonny Pursell

To allocate global memory that will be used by other applications than your own (AV-protocol, BubbleGEM, etc.) you cannot use the standard MALLOC() but should instead implement these routines supplied by Ulli Gruszka of RUN! Software.


Code to allocate global memory, by Ulli Gruszka (snipped from a thread in CSAS) and later tweaked by Lonny Pursell to allow the programmer to determine what type of memory to allocate.

Call this function once somewhere in your startup code:

Call this function if you need memory which will be used by other applications (AV-protocol, BubbleGEM)

Explanation of the problem, by Thomas Binder (snipped from the same thread in CSAS)

There's a problem on TT and Falcon TOS: Both crash or exhibit other strange behaviour when Mxalloc() is called with memory protection flags. Thus, the code Ulli provided ensures that the memory protection flags are masked off before a call to Mxalloc() is being made when there's no memory protection.

Note that the code doesn't actually test for memory protection, but for the existance of the Sysconf()-call. This is a GEMDOS call present in all versions of MiNT supporting memory protection, but not in TOS or MagiC. Andreas Kromke agreed that - if he implemented memory protection - MagiC would get this call, too.

Back to GFA-page