📄 chmem.1
字号:
.TH CHMEM 1.SH NAMEchmem \- change memory allocation.SH SYNOPSIS\fBchmem\fR [\fB+\fR]\fR [\fB\-\fR] [\fB=\fR] \fIamount file\fR.br.de FL.TP\\fB\\$1\\fR\\$2...de EX.TP 20\\fB\\$1\\fR# \\$2...SH EXAMPLES.EX "chmem =50000 a.out" "Give \fIa.out\fP 50K of stack space".EX "chmem \-4000 a.out" "Reduce the stack space by 4000 bytes".EX "chmem +1000 file1" "Increase each stack by 1000 bytes".SH DESCRIPTION.PPWhen a program is loaded into memory, it is allocated enough memoryfor the text and data+bss segments, plusan area for the stack.Data segment growth using .I malloc ,.I brk ,or.I sbrk eats up stack space from the low end.The amount of stack space to allocate is derivedfrom a field in the executable program's file header.If the combined stack and data segment growth exceeds the stack spaceallocated, the program will be terminated..PPIt is therefore important to set the amount of stack space carefully.If too little is provided, the program may crash.If too much is provided, memory will be wasted, and fewer programs will be ableto fit in memory and run simultaneously.\s-2MINIX\s+2does not swap, so that when memory is full, subsequent attempts to fork willfail.The compiler sets the stack spaceto the largest possible value (for the Intel CPUs, 64K \- text \- data).For many programs, this value is far too large.Nonrecursive programs that do not call.I brk ,.I sbrk ,or.I malloc ,and do not have any local arrays usually do not need more than 8K of stackspace..PPThe.I chmemcommand changes the value of the header field that determines the stack allocation, andthus indirectly the total memory required to run the program.The = option sets the stack sizeto a specific value; the + and \- options increment and decrement thecurrent value by the indicated amount.The old and new stack sizes are printed..SH "SEE ALSO".BR install (1),.BR brk (2).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -