[comp.sys.sgi] News-servers that grow but never shrink.

architec@cutmcvax.OZ (Phil Dench ) (12/04/89)

I have a problem.  When I 'psh' the following bit of code, the
news-server grows to about 17Mb.  It is probably mallocing appropriate
workspace to generate the image and then most likely frees that space.
Unfortunatly, the free() will not do a negative sbrk(), so we are left
with a news-server taking up 17Mb of swap space.


This sort of behavior is acceptable for your average sort of process.
It is run, then dies and the swap space is released. But the
news-server is always there (when you are), and noticabley slows
down after displaying a large image.


It would be nice if the news-postcript 'save' did something like...

	old_data_seg = sbrk( 0);

and the 'restore' did something like...

	brk( old_data_seg);

and then I could use 'save' instead of 'gsave', 'restore' instead of
'grestore'.  And it looks sort of logical too. A 'restore' that really
did restore the news-server to its previos state.


But is there a quick fix (other than logging out and in again)?


----8<--------8<--------8<--------8<--------8<--------8<--------8<----
%!
gsave
/imline 8 string def
/drawimage 
{
    4 4 8
    [4 0 0 -4 0 4]
    { currentfile imline readhexstring pop } image
} def
960 768 scale
drawimage
070C111423322233193A445AD998CEFF	% just rubbish - nothing significant
grestore
----8<--------8<--------8<--------8<--------8<--------8<--------8<----


NOTES:

We are previewing postscript files using a modified 'psview' before
sending them to a postscript printer. Some files include full page
images.

We are running 3.1D on a 4D-70GT.

	Phil Dench

--------------------------------------------+----------------------------------
                                            | School of Computer Science,
ACSNet: architec@cutmcvax.oz                | Curtin University of Technology,
UUCP:   ...!uunet!munnari!cutmcvax!architec | Kent Street,
ARPA:   architec%cutmcvax.oz@uunet.UU.NET   | Bentley
                                            | Western Australia, 6102
--------------------------------------------+----------------------------------

msc@ramoth.esd.sgi.com (Mark Callow) (12/08/89)

In article <124@cutmcvax.OZ> Phil Dench (architec@cutmcvax.uucp) writes:
> 
> It would be nice if the news-postcript 'save' did something like...
> 
> 	old_data_seg = sbrk( 0);
> 
> and the 'restore' did something like...
> 
> 	brk( old_data_seg);
> 
That's a great idea.  Unfortunately the data segment is shared among
all the light-weight processes.  Thus changing the sbrk could have
bad effects on other lwp's.

Fixing the problem requires major changes to the way memory is allocated
within the server.

> 
> But is there a quick fix (other than logging out and in again)?
Unfortunately no.

--
>From the TARDIS of Mark Callow
msc@ramoth.sgi.com, ...{ames,decwrl}!sgi!msc
"There is much virtue in a window.  It is to a human being as a frame is to
a painting, as a proscenium to a play.  It strongly defines its content."