sbrk(), brk() 메모리 할당(malloc) 시 호출되는 시스템 콜
참조 : https://en.wikipedia.org/wiki/Sbrk http://man7.org/linux/man-pages/man2/brk.2.html https://pubs.opengroup.org/onlinepubs/7908799/xsh/brk.html 메모리 관리에 사용되는 기본적인 시스템 콜 명령어 int brk(void * addr ); The brk() function sets the break value to addr and changes the allocated space accordingly. brk() 는 addr 주소 위치에 program break (현재 프로세스의 data segment의 끝부분 바로 다음 자리)를 설정한다. program break )를 설정한다. program break 의 위치를 옮김으로써 메모리를 할당하거나 반환한다. 성공시 brk() 는 0을 반환하고 실패시 -1 을 반환한다. void *sbrk(intptr_t increment ); The sbrk() function adds incr bytes to the break value and changes the allocated space accordingly. If incr is negative, the amount of allocated space is decreased by incr bytes. The current value of the program break is returned by sbrk (0). sbrk() 는 program break 에 increment 만큼 더한 뒤 그만큼 할당된 메모리를 변경한다. 만약에 increment가 음수이면 할당된 메모리는 ...