[vox-tech] can YOU be certified?!?

Peter Jay Salzman vox-tech@lists.lugod.org
Sun, 21 Jul 2002 11:22:27 -0700


begin Tim Riley <timriley@timriley.net> 
> 
> 
> Peter Jay Salzman wrote:
> 
> > begin ME <dugan@passwall.com>
> > > On Sun, 21 Jul 2002, Peter Jay Salzman wrote:
> > <snip>
> >
> > besides /cat/swaps, i thought of one more good way to know if you need
> > to add swap space:
> >
> > out of memory errors when you start new processes.
> 
> To confirm this I wrote the following program:
 
i'm not so sure you need to go through the trouble of doing this.

catting /dev/zero, piping to bzip2 and redirecting to /dev/null might to
the trick.  bzip2 at the highest compression is prolly not as fast as
disk I/O.  buffers grow, memory gets taken up, swap gets used.

> #include <stdio.h>
> #include <stdlib.h>
> 
> #define BUFFER_INCREMENT        1024000
 
snip
 
> Two weird things occurred when I ran this.
> 
> First, the "top" command never showed
> any swap space usage. Moreover, the
> memory available never made it to zero.
> It went from 28M down
> to 18M before the malloc failed.

that may not be wierd at all.   there's certainly a maximum amount of
heap that user space processes can be allocated.  you most likely hit
that limit.  you can't allow users to start allocating all the memory
they want.  that would lead to some very serious DoS attacks by non-root
users.


as for swap not being used, the maximum amount of heap simply is less
than your available physical RAM.

i think this explains both observations.

> Second and serendipitously, the bytes
> allocated was 14 times more that the
> total of memory and swap space.
> (I have 64M memory and 72M
> of swap (136M total), yet I was able to malloc
> 1987M of memory.)
 
> Can anyone see why?

hmmm... there goes my explanation.  but if it's not true, it ought to
be.   ;)

how much VRAM does your video card have?    (just kidding)

pete