Bad memory management examples and their testing using various tools
Include debug information while compiling
g++ -g file.cpp
gcc -g file.cpp
Note: if needed use static linking -static
valgrind --leak-check=full ./program args
Optional: --track-origins=yes
, --show-leak-kinds=all