Heap memory in C programming

What is heap memory?

Whenever a call is made to malloc, memory is allocated from what is called a heap. Where exactly is the bunch. I know that the program in the main memory is divided into a command segment, where program operators are represented, a data segment where global data is stored, and a stack segment where local variables and corresponding function parameters are stored. Now, what about the heap?

+2
source share
4 answers

The heap is part of your process address space. The pile can be grown or cut; you control it by calling brk(2)or sbrk(2). This is what it does malloc(3).

, , ; , , funcA(), -; - funcA(). funcA() ( ), funcA() .

, , . , (, free() , malloc()), .

, // , , , , ; , , ; .

+7
+2

. - , - " ". , - ( , malloc), (, ). , , , - , . , ( ), . , , .

, .

:

  • ,
  • C , malloc() free()
  • .

+2

, C C. C , malloc; ; .

, malloc , - , . . , , , , , heap POSIX malloc manual, .

, C, , C . , , , C-specific.

, , ; malloc () free ( , ) .

, malloc, , , , .

0

All Articles