MEMORY ALLOCATION REVISITED

David Spencer offers some more information on configuring memory allocations under RISC OS.

Last's month RISC User included a short utility program to dynamically change the allocation of blocks of memory such as the screen RAM and the font cache, without need for a hard reset. Since then, David Pilling has pointed out that there is in fact an undocumented module to do just this on the RISC OS applications disc. However, we can be excused for not finding it earlier, as it is hidden away in the Lander game. To install the module, mount the Apps 2 disc and enter:
QUIT
$.!Lander.Memalloc

Memalloc offers a total of nine star commands:
*SystemSize*RMASize
*ScreenSize*SpriteSize
*FontSize*RAMFSSize
*RMAFree*SpriteFree
*FontFree

The first six of these are used to set the total amount of memory allocated to the given area. The other three commands are used to set the amount of free space in the RMA, Sprite and Font areas independent of what is already in the particular area. All the commands have the same syntax, for example:
*FontSize <size> [<star command>]

The parameter size is the number of K to allocate (in decimal), and this will be rounded up according to page size. For example:
*ScreenSize 150
will in fact set the screen size to 160K.

Like last month's utility, these commands can only change memory allocations from outside an application (in other words from the star prompt). However, if the command fails in any way, it doesn't produce an error. Instead, the optional star command given after the size is executed. In the simplest case this could be made to cause an error by using the *Error command. For example:
*RMASize 240 Error 100 "RMASize failure"
Alternatively, in a more sophisticated scheme, the star command could be used to run another program which then tried to correct the source of the error.