Hi,
On Mon, 6 Dec 1999, Christopher T. Lansdown wrote:
> > 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),
> 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?
I had X die on me twice because of something like that- once because I
started Netscape while running twelve xquakes, and once because of a typo
in freesci/src/core/resource.c ;-)
> 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.
Wow...
> Btw, what I am proposing is something like:
[...]
> while(!space) {
> write_to_frame_buffer("Out of memory\n (free some up to
> continue)");
This requires the graphics target to handle the memory shortage correctly,
of course.
> sleep(1);
sleep() gets interrupted by signals (and GGI uses a signal to synchronize
the screen). A better way to handle this would be to call the
graphics target's "wait" function (which also reads mouse events and
updates the pointer position)
> space = malloc(size);
> if(space)
> restore_to_frame_buffer();
[...]
> Something to that effect where write_to_frame_buffer() will have to be
> written as well.
Doing a few memcpy()s and calling s->gfx_driver->Redraw() should suffice.
> 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.
Sounds good. Writing to stderr wouldn't help in fullscreen mode, after
all.
llap,
Christoph