I have written down a code that should do garbage collection for c programs. The problem is that I need to run it for a large number of objects say 100 mb dynamically allocated.
Is there any tool that can help me find out the memory usage of my c code at runtime. It would be pretty helpful if I can come to know the current heap size , or the number of memory blocks allocated etc. This is to compare the performance of my code. So it should run along with my code or itself run it.
If you do know please tell a little more information regarding its own impact at runtime etc.
Thanks a lot… 🙂
Look at valgrind. It provides a variety of memory analysis tools, including leak checking and heap profiling. The runtime overhead depends on the tool you are using; the full memory checker is slow, as it instruments all memory accesses, but the memory profiler should be pretty fast.