Helen
>I have also tried using sysgarbage() to reclaim any memory.
>
>However: an examination of (for instance) swap space used, via pstat -s, shows
>that the memory allocation INCREASES (!!AAAARRGGHHH!!) after any of these
>"memory reclaiming" functions has been called.
>
>Because of this; if I load a program, and then try to clear it out to make
>room for another, the second or third program refuses to run properly; and I
>get those horrible error messages on the console asking me if I have enough
>swap space etc, and fairly often I experience the dreaded "death" in sunview.
>
>Does anyone know of a simple way of persuading poplog to genuinely clear out
>all the unwanted garbage?
Depending on what else you were examining, you may have found that it
was the pwmtool process rather than the Poplog process which was
increasing in size (when I created and then killed some PWM graphics
windows, the Poplog process size stayed the same, while the pwmtool
process size increased after each operation). I'm not sure whether
this is caused by the pwmtool or the SunView libraries.
As far as actually reducing the process size, this is a real problem on
many operating systems. The following C code allocates and frees some
memory:
stats() { system("/usr/etc/pstat -s"); }
main()
{
char *p, *q;
int i;
stats();
p = (char *) malloc(2000000); /* alloc 2Mb */
stats();
for (i=1; i<2000000; i++) p[i] = 1; /* touch all bytes */
stats();
q = (char *) malloc(1000000); /* alloc 1Mb */
stats();
for (i=1; i<1000000; i++) q[i] = 1; /* touch all bytes */
stats();
free(q); /* free the space */
stats();
free(p);
stats();
}
Running it on a SPARCstation under SunOS4.1.3 gives:
csh 1 % a.out
2620k allocated + 788k reserved = 3408k used, 49236k available
2628k allocated + 2740k reserved = 5368k used, 47276k available
4576k allocated + 792k reserved = 5368k used, 47276k available
4584k allocated + 1764k reserved = 6348k used, 46296k available
5552k allocated + 796k reserved = 6348k used, 46296k available
5552k allocated + 796k reserved = 6348k used, 46296k available
5552k allocated + 796k reserved = 6348k used, 46296k available
csh 2 %
Even when the allocated memory is freed, the amount of available swap
does not increase.
Julian
|