title: Logic to find heap memory space
body: <p>I want to write an function in c code to find the free heap space available, so i decided to find the diff. b/w program break and stack pointer that will give the heap space available. I used sbrk(0) to find the program break value i observed "<strong>Program break value was increasing continuously</strong>" every time I run my executable.</p>
  
  <p>1) Why is it increasing every time? if the heap and stack at address space are individual for each process it should not increase until I call malloc() right?</p>
  
  <p>2) please let me know if i'am using right logic to find the heap space available, if not please explain correct logic to do it.  </p>
  
  <p>Os:Linux Code:C</p>