[algogeeks] Re: heap memory

2011-11-14 Thread sumit mahamuni
On Nov 5, 10:28 pm, himanshu kansal himanshukansal...@gmail.com wrote: can we know the size of heap memory allocated to our program Hi, from my knowledge of OS, when program is loaded in the memory the heap is not allocated to the process. as the requests made by the process, the

[algogeeks] Re: heap memory

2011-11-07 Thread Gene
I think you just said the same thing I did. I disagree. As I said, you get an approximation with wrappers. You can track the amount of memory actually in use by the client program. For malloc/frees that don't return memory to the OS once allocated (this includes glibc in Linux), you can also

Re: [algogeeks] Re: heap memory

2011-11-07 Thread Jagannath Prasad Das
I think its same as the Virtual memory On Mon, Nov 7, 2011 at 4:22 PM, Gene gene.ress...@gmail.com wrote: I think you just said the same thing I did. I disagree. As I said, you get an approximation with wrappers. You can track the amount of memory actually in use by the client program. For

Re: [algogeeks] Re: heap memory

2011-11-06 Thread himanshu kansal
@Gene: since the article itself says that if the memory is allocated through malloc, it will make some (less) sbrk calls to the system to increase the allocated memory to the program. then how can a wrapper function will do the malloc internally will call the sbrk function and will increase

[algogeeks] Re: heap memory

2011-11-05 Thread Gene
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