3 chmem \- change memory allocation
5 \fBchmem\fR [\fB+\fR]\fR [\fB\-\fR] [\fB=\fR] \fIamount file\fR
18 .EX "chmem =50000 a.out" "Give \fIa.out\fP 50K of stack space"
19 .EX "chmem \-4000 a.out" "Reduce the stack space by 4000 bytes"
20 .EX "chmem +1000 file1" "Increase each stack by 1000 bytes"
23 When a program is loaded into memory, it is allocated enough memory
24 for the text and data+bss segments, plus
25 an area for the stack.
26 Data segment growth using
31 eats up stack space from the low end.
32 The amount of stack space to allocate is derived
33 from a field in the executable program's file header.
34 If the combined stack and data segment growth exceeds the stack space
35 allocated, the program will be terminated.
37 It is therefore important to set the amount of stack space carefully.
38 If too little is provided, the program may crash.
39 If too much is provided, memory will be wasted, and fewer programs will be able
40 to fit in memory and run simultaneously.
42 does not swap, so that when memory is full, subsequent attempts to fork will
44 The compiler sets the stack space
45 to the largest possible value (for the Intel CPUs, 64K \- text \- data).
46 For many programs, this value is far too large.
47 Nonrecursive programs that do not call
52 and do not have any local arrays usually do not need more than 8K of stack
57 command changes the value of the header field that determines the stack allocation, and
58 thus indirectly the total memory required to run the program.
59 The = option sets the stack size
60 to a specific value; the + and \- options increment and decrement the
61 current value by the indicated amount.
62 The old and new stack sizes are printed.