home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
375.lha
/
IncrStorageManager_v1.0
/
README
< prev
next >
Wrap
Text File
|
1990-05-02
|
5KB
|
133 lines
PRODUCT: Incremental Storage Manager
VERSION: 1.0
AUTHOR:
Daniel B. Hankins
143 Montgomery Street
Poughkeepsie, NY 12601
dan-hankins@cup.portal.com
CREATION DATE: 1989
RELEASE DATE: November 21, 1989
NOTICE OF INTELLECTUAL PROPERTY:
This material is *NOT COPYRIGHTED*. By this notice, I hereby place
this program and all its parts in the public domain, under the definitions
and restrictions of United States law.
HISTORY OF REVISIONS:
None yet.
FILE DISTRIBUTION:
README FreeHandle.def
Build.Rexx FreeHandle.mod
DynamicItem.def HandleCollection.def
DynamicItem.mod HandleCollection.mod
DynItem.def Storage.def
DynItem.mod Storage.mod
DynItemList.def WordAlign.def
DynItemList.mod WordAlign.mod
DynTest.mod
WHAT IT CAN DO FOR YOU:
This set of modules constitutes a storage manager with garbage
collection for Modula-2 programs. It is written in TDI Modula-2 for the
Amiga, but should be easily portable to other implementations and
architectures.
It uses *INCREMENTAL* garbage collection. Most garbage collectors
create and destroy items willy-nilly until storage is exhausted. Then they
hold up all other processing while they copy all the in-use items down to
one end of the storage space, thus freeing up the rest of the space for more
items.
In incremental garbage collection, a few items are copied every time a
New() or Dispose() is done. This results in overhead which in total is
larger than that of stop-and-copy methods, but which never causes the
system to halt while collection is done. This is far more suitable for
programs which require real-time response or close to it.
Also, most storage managers begin with a statically sized storage
space and allocate from that. This requires the user to guess before
running a program that uses storage management how much storage is going to
be needed. Guess too small, and the program aborts. Guess too large, and
storage is wasted; other programs can't get space to run in.
This storage manager frees the user from these considerations, and is
a good system citizen in the bargain; it allocates storage in blocks of
1K granularity from the operating system, and suballocates from these.
Whenever a block becomes unused, the manager returns it to the system.
HOW TO USE IT:
The procedures which perform the services of the manager are defined
in DynamicItem.def. Build.Rexx contains an ARexx program that will build
the link and symbol files for the manager in the correct order (provided
you are using TDI Modula-2). Just import the procedures and types you want
from DynamicItem, and you'll be in business.
The module DynTest.mod is included for those that would like to see it
work for themselves; I used it to test the services.
BUGS AND CAVEATS:
I've tested the code pretty thoroughly, so I don't think there are any
bugs in it. If you find some, let me know via snail mail or Usenet mail.
The addresses are listed at the top of the file. Or just post in
comp.sys.amiga; I read it fairly often.
Performance is probably not all that great; I organized the code in a
*very* object oriented way, in order to make development easier on myself,
and to make the code easier to read for those who'd like to fiddle with it.
As a result, there are many procedures which consist of one, two or a very
few statements. This adds considerably to the procedure call overhead.
PLANS AND FUTURE FEATURES:
* Single-module version
I am in the process of developing a single-module version of this
program, with procedures made in-line where appropriate. That version will
be distributed along with the object-oriented version. Future improvements
will be made in parallel to both versions.
* Granularity control
I plan to introduce a variable which the programmer can change to
indicate with what granularity storage should be allocated from the
operating system. The minimum granularity, 1K, is hard-wired into the code
at present. The programmer will be able to change this to 2K or 4K or 37K
or whatever.
* Last-ditch stop-and-copy
I plan to add code which handles the eventuality where no more storage
can be gotten from the operating system, but not all unused space has been
reclaimed from existing storage blocks. The new code will attempt to
rearrange items in the existing blocks in order to make room for the new
item. Currently the code checks existing blocks for unused space. If it
cannot find what it needs there, then it attempts to allocate storage from
the operating system. If that fails, NIL is returned. The new code will
add another level of attempt.
The new feature will be able to be switched on and off by means of a
control variable.
THE LAST WORD:
I hope this is of use to Modula-2 programmers. Send comments, kudos,
insults, gifts, and flames to the addresses listed at the top of this file.
Share and Enjoy!
THE WORD AFTER THE LAST WORD:
"Darrell suspected someone had once again slipped him a spoon with the
concave side reversed."
- Gary Larson, The Far Side