> Chris' concept of waiting until memory becomes available isn't going to
> help too much if we're really short on memory (the FreeSCI process is
> likely to be one of the first processes to get slaughtered by the admins),
> but it's the most technically correct solution- after all, memory shortage
> is supposed to be a recoverable problem.
Well, you're assuming that the memory is being taken up entirely by
processes that are supposed to be taking it up.  Haven't you ever seen an
errant process that eats all memory from bugs?  Or a malloc bomb?  Or run
netscape for a few days straight?
        Not all out of memory conditions are caused by critical databases
that need to stay up.  Plenty of them are conditions remedeable by killing
off one offending process which has bugs and isn't the free sci program. 
I'd personally hate to lose part of my game because netscape became too
bloated and I forgot to shut it down.  I remember one time when I ran out of
memory because netscape had eaten something like 243 megs of RAM + swap. 
Believe me, it was netscape that I killed, not the game I was playing at the
time. :-)
        Btw, what I am proposing is something like:
void *sci_malloc(long size) {
        void *space;

        space = malloc(size);

        while(!space) {
                write_to_frame_buffer("Out of memory\n (free some up to
continue)");
                sleep(1);
                space = malloc(size);
                if(space)
                        restore_to_frame_buffer();
        }

        return space;
}

Something to that effect where write_to_frame_buffer() will have to be
written as well.  I'm figuring something like a global bit of space for the
current contents will be stored, then when write_to_frame_buffer is called,
a central rectangle is copied to the allocated at startup storage buffer,
then the message is written on top of the screen.  Once the memory is
gotten, the small rectangle is restored.
        This way we can survive out of memory situations.  I generally
believe that processes should die only when the users want them to, not at
the drop of a hat.  After all, what's the point in being stable if you're
still at the mercy of every bad process on a system?
        -Chris

-- 
[EMAIL PROTECTED]
"If I had had more time I would have written a shorter letter." - Pascal
Linux Programs: http://cs.alfred.edu/~lansdoct/linux/
Linux - Get there. Today.
Evil Overlord Quote of the Day (www.eviloverlord.com):
99. Any data file of crucial importance will be padded to 1.45Mb in size.

Reply via email to