## bloat

#### OS/161 Reference Manual

### Name

bloat - waste memory

### Synopsis

`/testbin/bloat` [`-a` allocs] [`-b` bias] [`-p` touchpages]

### Description

`bloat` allocates all available memory one page at a time until it runs out. Unlike other tests that do this, it has been gimmicked up so that it runs in a fairly reasonable amount of time even when swapping.

It runs in cycles; every cycle it allocates allocs pages, one at a time, by calling sbrk (not malloc), then touches touchpages pages. It chooses the pages it touches as follows:

- 1 in 1000 pages are chosen uniformly from the entire allocated space.

- The rest are taken from the middle 1% of the space; note that this range shifts upwards as more pages are allocated.

- It rolls bias dice to pick pages from the middle 1%. The more dice, the tighter the distribution it picks and the faster it runs.

The default settings are 4 allocs, 8 touchpages and a bias of 8. This gives reasonable performance with reasonable amounts of memory on the solution set. There are enough things affecting the speed that you may want to experiment with the settings when testing on your own VM system.

### Requirements

`bloat` uses the following system calls:

- sbrk
- write
- _exit

`bloat` should work once you have implemented your VM system and added the sbrk system call. It may not run fast by default, but it should always be faster than sbrktest 10 or the notoriously glacial malloctest 3.