valgrind

Dynamic analysis tool for memory debugging and profiling

brewmacoslinux
Try with needOr install directly
Source

About

Dynamic analysis tools (memory, debug, profiling)

Commands

valgrindcallgrindcachegrindmassifhelgrind

Examples

Detect memory leaks in a program$ valgrind --leak-check=full ./your_program
Profile cache performance of a program$ valgrind --tool=cachegrind ./your_program
Analyze heap memory usage over time$ valgrind --tool=massif ./your_program