An implementation of ALLOCATE FREE RESIZE in Forth-94
- raw LICENSE
- raw README.md
- raw dynamic.fs
- raw package.4th
Am implementation of Knuth's dynamic memory allocation algorithm in Forth-94
Ulrich Hoffmann <firstname.lastname@example.org>
Version 1.0.0 - 2016-10-30
This package provides an implementation of a dynamic memory scheme as proposed by Donald E. Knuth  and implemented in Forth(-83) by Klaush Schleisiek . It has been updated to Forth-94 and augmented by Ulrich Hoffmann.
The package exposes the standard words
RESIZE, and the
EMPTY-MEMORY for initialization and
SIZE for retrieving the size of
an allocated block.
To use dynamic memory, just
INCLUDE dynamic.fs on any standard system. This makes
the memory allocation words available. After loading you still have a standard system.
See the file glossary.md for a description of the defined words.
here 10000 dup allot empty-memory
Allocate memory areas
500 allocate . ( -> 0 ) 700 allocate . ( -> 0 ) ( two addresses now on the stack )
over size . ( -> 500 ) dup size . ( -> 700 ) 1000 resize . ( -> 0 ) \ enlarge 50 resize . ( -> 0 ) \ shrink
free . ( -> 0 ) free . ( -> 0 )
Please send bug reports, improvements and suggestions to Ulrich Hoffmann <email@example.com>
This program conforms to Forth-94 and Forth-2012.
 D. E. Knuth, "The Art of ComputerProgramming", Vol.1, Pg.442, Algorithm C
 K. Schliesiek, "Dynamic Memory Allocation", FORML 88 Conference Proceedings, p.73ff
May the Forth be with you!