In C you can get close by wrapping malloc() and free() and maintaining your own total. This will not capture the header within each malloc()'ed block.
You can also use a tool like valgrind . The behavior of sbrk() is totally OS dependent, and sbrk() doesn't exist on e.g. Windows. This method won't work reliably on Linux either. Here is a pretty good article for details on Linux memory allocation: http://www.linuxjournal.com/article/6390?page=0,0 On Nov 5, 6:28 pm, himanshu kansal <[email protected]> wrote: > can we know the size of heap memory allocated to our program???? > > i think sbrk(0) will return the address of end of heap..... > but how to find the start of heap so that we can calculate the size of > total heap memory allocated to our program.... > > is there any way possible???? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
