home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
hensa
/
memmanagement
/
rmbroom_1
/
!RMBroom
/
!Help
next >
Wrap
Text File
|
1994-09-17
|
5KB
|
147 lines
RMBroom version 1.00 7 Apr 1994
-------------------------------
Introduction
------------
RMBroom RMKills modules which are no longer used - i.e. when
all the applications which were using a module are closed down.
RMBroom keeps a count of how many applications are using each module, and
RMKill's any module whose count reaches zero.
Note that RMKill-ing a module will not always give you back the modules
memory imediately because the RMA can get very fragmented.
How to use RMBroom
------------------
RMBroom has to be told which modules each application uses. You do this by
setting a system variable for each appliction called 'RMBroom$<app name>'
to contain a space-separated list of the modules which each application
uses (The application will probably have RMEnsure/RMLoad commands in its
!Run file for each of these modules).
<app name> should be the name which appears in the task-managers window
(if this contains spaces, replace them with underscores '_').
The Obey file '!RMBroom.Apps' in RMBroom's application directory sets
RMBroom$... variables for the applications which I use or have seen.
Have a look to see how everything works. Simply add to this file to
include the applications and their modules which are used on your
machine. This file is run when RMBroom starts up.
If you change !RmBroom.Apps while RMBroom is running, then
just double-click on !RmBroom.Apps - there is no need to restart
!RMBroom.
RMBroom doesn't have an iconbar icon - use the task-manager window to quit
it. You can start RMBroom after other applications have started - it looks
at all running tasks when it starts up.
Note that RMBroom will never RMKill modules which you haven't told it
about.
Application close-down commands
-------------------------------
In addition to RMKill-ing modules, you can make RMBroom execute a
command when a task terminates. This is normally difficult to do in RISC
OS because of a bug in the Obey module which prevents you from having
any commands after the 'Run <foo$Dir>.!RunImage' in an applications !Run
file.
For example, I wanted to increase the font cache before my wordprocesor
starts up (easy - just a line in its !Run file), then decrease it when
it finished (not so easy - you can't put commands after the 'Run
<Obey$Dir>.!RunImage'.
The solution which !RMBroom provides is to append a hyphen '-' to the
system variable 'RMBroom$<appname>' (after any module names), followed by a
command. When the application quits, the text starting after the '-' is
passed to the Command Line Interpreter (CLI). Thus, I have set the variable
'RMBroom$TechWriter' to be '-ChangeDynamicArea -FontSize 32k'. If you
wanted to do more complicated things such as have multiple commands, you
could use '-Filer_Run |<foo$Dir>.!Stop' which would run a file '!Stop'
in an application's directory after the app finishes.
Warning
-------
Note that RMKill-ing a module while an applcation which uses it is still
running will probably cause the application to crash. This means that if
you forget that (say) !Templed uses the 'MenuUtils' module, and so don't
set 'RMBroom$TemplEd' to include 'MenuUtils', RMBroom could RMKill
MenuUtils whilst TemplEd is still using it.
RMBroom queries you for each RMKill using a standard error box. You can
make the RMKills automatic if you want - see the !Run file.
Vaguely technical stuff
-----------------------
In an ideal world, the counting of users of modules would be done using
an OS command, (e.g. like the registering of event handlers). The
solution which RMBroom provides is a bit clunky, but the best I can
think of.
The main problem is that RMBroom takes up a 32k wimpslot on a 4MB machine.
I would have written it as a module, but, while there is a
Service_WimpCloseDown service call, there doesn't seem to be a service call
which tells of an application starting up, so the program has to be a wimp
task, and detect Wimp messages for task start/stop. There might be a way of
making RMBroom a module by intercepting the Wimp_Initialise SWI, but this
seemed a bit complicated to me!. Also, I was hoping to make RMBroom into a
module-task, which would not use a full page of memory, but according to an
Acorn technical note (from ftp.acorn.co.uk), this is not possible for a
module written in C.
Other stuff.
------------
!RMBroom is Freeware and copyright Julian Smith 1994
If anybody has a sprite of a broom, could you possibly send it to me to use
as a sprite for the RMBroom application?
If you have any comments or suggestions on this program, I would be very
glad to here them. Particulaly welcome would be ideas on how to make a C
module detect tasks starting/stopping.
- Julian Smith
------------------------
julians@cogsci.ed.ac.uk
------------------------
or:
------------------------
Department of Psychology
University of Edinburgh
7 George Square
Edinburgh
EH8 9JZ
UK
------------------------