sbrktest

OS/161 Reference Manual

Name

sbrktest - program for testing sbrk

Synopsis

/testbin/sbrktest [test-number ...]

Description

sbrktest contains a number of tests for memory allocation, using the sbrk low-level interface directly instead of via malloc. It is similar to malloctest in general layout and approach, but concentrates on kernel-level memory allocation rather than the behavior of C malloc.

There are 21 tests:
1Allocate one page.
2Allocate and free one page.
3Allocate and free several pages.
4Allocate several pages and free them one at a time.
5Check the heap end. This test crashes intentionally.
6Allocate and check the heap end. This test crashes intentionally.
7Allocate and free and check the heap end. This test crashes intentionally.
8Allocate several, free some, then check the heap end. This test crashes intentionally.
9Allocate all memory in a big chunk.
10Allocate all memory one page at a time.
11Allocate a lot and intentionally leak it.
12Fork and then allocate.
13Allocate and then fork.
14Allocate and then fork and free.
15Allocate, fork, allocate more, and free.
16Small stress test.
17Randomized small stress test.
18Small stress test with specific seed.
19Large stress test.
20Randomized large stress test.
21Large stress test with specific seed.

One or more tests may be run specifically by giving the numbers on the command line; otherwise, sbrktest prints the list and prompts for a test number to run.

Note that the tests that crash intentionally should crash the sbrktest program with an illegal memory access (SIGSEGV) -- they should not crash your kernel.

The tests that attempt to allocate all available memory may be slow, depending on the per-process limits you place on memory allocation (if any) relative to the amount of available physical RAM.

Requirements

sbrktest uses the following system calls:

sbrktest should work properly once you have implemented the sbrk system call and a virtual memory system that supports dynamic memory allocation. It will not work with dumbvm.