Bug 226943 - There's no %ram% device.
There's no %ram% device.
Product: Ghostscript
Classification: Unclassified
Component: PS Interpreter
All All
: P4 enhancement
Assigned To: Ken Sharp
Bug traffic
: bountiable
Depends on:
  Show dependency treegraph
Reported: 2000-12-27 20:35 PST by Jack Moffitt
Modified: 2013-09-11 05:23 PDT (History)
0 users

See Also:
Word Size: ---

preliminary patches for %ram*% device family (69.75 KB, patch)
2006-09-30 19:31 PDT, david d zuhn
Details | Diff
%ram% device (28.85 KB, patch)
2007-01-18 21:43 PST, Michael (Micksa) Slade
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jack Moffitt 2000-12-27 20:35:28 PST
Originally reported by: nobody@users.sourceforge.net
GS doesn't have %ram% device reguired on all Level 3 products.
it is documented in PS Supplement 3010 and 3011 dated August 30, 1999

Comment 1 L. Peter Deutsch 2000-12-31 09:45:30 PST
Comment originally by lpd@users.sourceforge.net
Yes, this should be implemented. As Alex suggested, it can be implemented using the (disk) file system rather than actual RAM, and I think it should be implemented this way, at least initially, since that will be easy. On Unix, I suggest it be implemented with a directory /tmp/$$/ (where $$ is the process id), which Ghostscript should delete when it exits.
Comment 2 Ray Johnston 2001-04-03 18:17:18 PDT
Comment originally by rayjj@users.sourceforge.net
Logged In: YES 

You've pointed out a useful enhancement to Ghostscript. We don't
have plans to implement it at the moment, but we are adding it to
the Project.htm file within the Ghostscript distribution. With
luck, someone will pick the project up for implementation at some
later date.

Thanks for your input!
Comment 3 Stefan Kemper 2005-07-06 13:29:03 PDT
Customer request for feature
Comment 4 Ray Johnston 2005-07-08 09:06:43 PDT
This is a fairly straightforward feature to implement.

Ghostscript has provisions for adding "IODevice" entries such as the 'diskn'
(e.g. %disk0%, %disk1%, ...) that implements a flat file naming system independent
of the underlying %os% file system. Much of the diskn device can be used as an
example since this IODevice implements (in gsiodisk.c):
     iodev_diskn_init, iodev_diskn_fopen, diskn_delete, diskn_rename,
     diskn_status, diskn_enumerate_files_init, diskn_enumerate_next,
     diskn_enumerate_close, diskn_get_params, diskn_put_params 

A %ram% device will also need a _fclose function and probably can do without
any 'put_params' or 'get_params' special handling since initialization can be
done in the _init call.

The initial implementation would probably maintain a linked list of "files"
maintained in enumeration order. The file contents initially could just be
single allocations or could be a more sophisticated chain of compressed
blocks. I don't see any reason these allocations need to be garbage collected
thus avoiding the need for 'st_' GC structure definitions.
Comment 5 Michael (Micksa) Slade 2006-06-18 07:25:02 PDT
So which is bountiable?  Real RAM disk or pretend RAM mapped to temp dir?
Comment 6 Ray Johnston 2006-09-13 09:02:48 PDT
No response on using the %disk device for font downloading from customer.
Removing customer ID, but leaving bountiable bug open at P4 priority.
Comment 7 david d zuhn 2006-09-30 19:31:14 PDT
Created attachment 2517 [details]
preliminary patches for %ram*% device family

Here's a set of patches which implement most of the things needed for a %ram%
device.  It uses the temporary directory and real files approach.   It's not
yet complete (the directory and files are not automatically removed at program
exit).	 Other concerns are noted in the patch file itself.   

This patch is against v8.54.
Comment 8 Michael (Micksa) Slade 2007-01-18 21:43:05 PST
Created attachment 2700 [details]
%ram% device

I risk shaking things up a little doing this but I'll give it a shot.

Attached is a patch for a *real* RAM device.

It comes in 2 parts - ramfs.[ch] which provides the ram device itself with a
unix-like interface, and gsioram.c which turns it into %ram%.

The device does not support subdirectories.  The single directory is stored as
a linked list.	Each file's data is stored as a dynmically extended array of
blocks, known as a hashed array tree in some circles.  It uses inodes so you
can safely delete open files, etc.

I have given it a basic but pretty thorough test, but haven't written a full
hardcore test suite for it since I'm sure someone at ghostscript.com has
something that can test it to death.

The makefile voodoo I've added is probably not the Right Way to compile it in
so could someone please check up on this, thanks.

Also please try it out and let me know if it works or doesn't work for you.
Comment 9 Ken Sharp 2013-06-21 16:09:03 PDT
I'm trying to contact Michael Slade with regards to this bug, if anyone has current contact details, can they please let me know.
Comment 10 Ken Sharp 2013-09-11 05:23:56 PDT
commits b5472ea6bf6925023febdeab12be9dbd83e811f1 
and db45b95faa06f8204b9a075323125d7f398c5d06 implement the patches from Michael Slade with some modifications to replace the system memory handling with Ghostscript garbage collected memory handling.