[ColorForth] temporary memory allocation
- Subject: [ColorForth] temporary memory allocation
- From: Mark Slicker <maslicke@xxxxxxxxxxx>
- Date: Wed, 1 May 2002 20:48:42 -0400 (EDT)
On Sun, 28 Apr 2002, Charles Shattuck wrote:
> I don't know about elegant, but a practical way might be to figure out
> what blocks are free and just use them explicitly. If the spirit of
> colorForth is extreme simplicity then a mark stack sounds like overkill
> to me. If you need an extra stack to keep track of memory allocations
> maybe you should rethink your original problem instead and find a
> simpler solution.
>
I think what I'm doing is appropriate, however I'm open to sugestions. I'm
writing a jpeg decoder, and I've found jpeg requires some tables to be
generated, and additional space for one mcu (minimum coded unit). This
data is only needed during the decoding process, after which it can be
discarded. Also, I should note the ammount of temporary space may vary
depending on the particular image.
I could certainly calculate the maximum ammount of space required
designate this many blocks for my algorithm, however I think this runs
counter to the design of colorForth. colorForth already has heap, which
is the dictionary space. If you notice, when you load a program, all the
tables and word defintions needed are compiled to the dictionary
space. This sugests to me using dictionary space for temporary space as
well. As an added bonus, you can use the comma operators aleady
defined. These provide an elegant method for sequential writes to
memory. Although I haven't written the colorForth code yet, I imagine
these will simplify my algorithm greatly. The only problem remaining is to
reset the dictionary pointer (free the memory). I think Chuck's method
will work fine, although unfortunately, I think it requires adding a new
word to the kernel (to set h), creating an incompatible colorForth.
Mark
------------------------
To Unsubscribe from this list, send mail to Mdaemon@xxxxxxxxxxxxxxxxxx with:
unsubscribe ColorForth
as the first and only line within the message body
Problems - List-Admin@xxxxxxxxxxxxxxxxxx
Main ColorForth site - http://www.colorforth.com