Re: Swapping rooms to disk

From: Cervo (chrisf@PTD.NET)
Date: 07/03/98


On Fri, 3 Jul 1998, George wrote:

> Here's an ugly 10 minute hack to keep room descriptions on disk instead of
> in memory.  This is unique from previous attempts in that it doesn't load
> the descriptions from disk if not used, they are _always_ on disk.
>
> It saves 512 KB on a stock CircleMUD world but creates a 3 MB world binary
> file on disk.  I've already thought of a better way to do this so don't
> tell me it's inefficent, I know and would never use this version
> personally. :)
>
> Mostly posted as a proof of concept type thing.  I originally had it
> keeping the world file open, but decided that the OS might mmap() the file
> and thus use memory even after we don't want it.  Think of this as a
> paranoid memory saving thing.
>
> NOTE: A change was not made to act.wizard.c for do_stat_room which would be
> required if using this.
>
> Anyway...let's see what ideas other people have...

There once was a time when I was really bored, so I experimented with
circle's zone tables to see what was the coolest method for making zones.
I tried making all the zones into binary files, and changing db.c and all
of the commands that directly accessed the files into the binary files
command, and the zones actually ran pretty smoothly.  I was so bored, I
even made an olc to play with the zones, but it would have been a hassle
to convert circle zones to the olc, and if I decided to change the format,
all the records would have to be deleted, and re-ordered. Your method here isn't
that bad, maybe you should make a circlemud for those who are in
memory poverty and include it :P The Problem with RAM is not
mine, but I figured it would be cool to know if there was an easier way
for creating swap files,
so I might utilize it in other uses.
Generally Circlemud is very good on memory, however I hear many imps
complaining that when they get muds so goods that > 100 players come on at
a time, the siteadmins get upset and throw the muds off.  Therefore the
most pheasable solution, short of limiting the online players, seems to be
a swapfile.  The problem may one day come, and it would be good to have a
solution, however it looks like I will have to write my own memory
manager, and that there will no chance at all of it being portable.
Anyway thank you for the help.  Although putting strings into binary files
isn't a bad idea.  What I'm trying to do is make a failsafe last resort
way, so if all else fails go to emergency swap mode.  This is also good
for other programs that I may make also, because all programs have data
that need not be loaded directly into memory.  Instead of writing it to
disk, freeing it, reloading it, and storing it into the structure, it
would be easy just to find that section in RAM and swap it to the disk,
then it is all ready for when i want to use it.  It may take a few good
books on memory theory and ASM, but hopefully I can get a memory manager
coded :P  Anyway thanks for your input.


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST