Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

brk(2) [v7 man page]

BRK(2)								System Calls Manual							    BRK(2)

NAME
brk, sbrk, break - change core allocation SYNOPSIS
char *brk(addr) char *sbrk(incr) DESCRIPTION
Brk sets the system's idea of the lowest location not used by the program (called the break) to addr (rounded up to the next multiple of 64 bytes on the PDP11, 256 bytes on the Interdata 8/32, 512 bytes on the VAX-11/780). Locations not less than addr and below the stack pointer are not in the address space and will thus cause a memory violation if accessed. In the alternate function sbrk, incr more bytes are added to the program's data space and a pointer to the start of the new area is returned. When a program begins execution via exec the break is set at the highest location defined by the program and data storage areas. Ordinar- ily, therefore, only programs with growing data areas need to use break. SEE ALSO
exec(2), malloc(3), end(3) DIAGNOSTICS
Zero is returned if the break could be set; -1 if the program requests more memory than the system limit or if too many segmentation regis- ters would be required to implement the break. BUGS
Setting the break in the range 0177701 to 0177777 (on the PDP11) is the same as setting it to zero. ASSEMBLER
(break = 17.) sys break; addr Break performs the function of brk. The name of the routine differs from that in C for historical reasons. BRK(2)

Check Out this Related Man Page

brk(2)								System Calls Manual							    brk(2)

Name
       brk, sbrk - change data segment space allocation

Syntax
       #include <sys/types.h>

       char *brk(addr)
       char *addr;

       char *sbrk(incr)
       int incr;

Description
       The  system  call sets the system's idea of the lowest data segment location not used by the program (called the break) to addr (rounded up
       to the next multiple of the system's page size).  Locations greater than addr and below the stack pointer are not in the address space  and
       thus will cause a memory violation if accessed.

       In the alternate function incr more bytes are added to the program's data space and a pointer to the start of the new area is returned.

       When  a	program  begins  execution by the break is set at the highest location defined by the program and data storage areas.  Ordinarily,
       therefore, only programs with growing data areas need to use

       The system call may be used to determine the maximum permissible size of the data segment; it will not be possible to set the break  beyond
       the rlim_max value returned from a call to For example:
       0x10000000 + rlp -> rlim_max

Return Values
       Upon successful completion, the system call returns a value of 0 or -1 if the program requests more memory than the system limit.  The sys-
       tem call returns -1 if the break could not be set.

Restrictions
       Setting the break may fail due to a temporary lack of swap space.  It is not possible to distinguish this from a failure caused by  exceed-
       ing the maximum size of the data segment without consulting

Diagnostics
       The system call fails and no additionally memory is allocated if one of the following is true:

	      [ENOMEM]	   The limit, as set by was exceeded.

	      [ENOMEM]	   The maximum possible size a data segment (compiled into the system) was exceeded.

	      [ENOMEM]	   Insufficient space existed in the swap area to support the expansion.

See Also
       execve(2), getrlimit(2), setrlimit(2), ulimit(2)

								       RISC								    brk(2)
Man Page

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

attempting to break within function

Attempting to break from a case/esac paragraph while inside of a function. When executing the code below, entering the letter 'a', will prove that the directory exists, but the break command works for the if/fi, but not for the case/esac. So, in my example below, if an A is entered, the function... (8 Replies)
Discussion started by: tumblez
8 Replies

2. Solaris

How send break in T5220 Box?

Hi, I used "send brk" from terminal in T5220 Box, but no response. Anyone know what's reason? Thanks! (7 Replies)
Discussion started by: xlen
7 Replies

3. Solaris

send break

Does anyone know how to send break on a Blade 100? I'm using a serial cable on my laptop and I can see the system boot up just fine, but I want to send break so i can have it boot from cdrom instead of disk. (3 Replies)
Discussion started by: em23
3 Replies

4. Programming

segmentation fault

Hi, I am having this segmentation fault not in the following program, bt. in my lab program . My lab program is horrible long so cannot post it here bt. I am using the following logic in my program which is giving the segmentation fault. Bt. if I run this sample program as it is it dosen't give... (3 Replies)
Discussion started by: mind@work
3 Replies

5. UNIX for Dummies Questions & Answers

How can I set DBX to break on an Access Violation?

I'm trying to debug a service crash, and would like to break on an access violation - is this possible? (0 Replies)
Discussion started by: ctote
0 Replies

6. UNIX for Dummies Questions & Answers

Find a string across line break (because of "segmentation fault core dumped")

Hi, thanks to a precedent post, and thanks to the reply of derekludwig of the forum, I have convert my first awk command as : test.txt is : AAAAAGHIJKLAjKMEFJKLjklABCDJkLEFGHIJKL awk -f findstring.awk test.txt > textreturn.txtfindstring.awk is : BEGIN{ SLENGTH = 3 } { ... (3 Replies)
Discussion started by: thewizarde6
3 Replies