Bugzilla – Bug 226943
There's no %ram% device.
Last modified: 2013-09-11 05:23:56 PDT
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 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 originally by rayjj@users.sourceforge.net Logged In: YES user_id=11206 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!
Customer request for feature
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.
So which is bountiable? Real RAM disk or pretend RAM mapped to temp dir?
No response on using the %disk device for font downloading from customer. Removing customer ID, but leaving bountiable bug open at P4 priority.
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.
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.
I'm trying to contact Michael Slade with regards to this bug, if anyone has current contact details, can they please let me know.
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.