Install electric-fence by entering the following commands in the terminal:
sudo apt update sudo apt install electric-fence
A malloc(3) debugger
Electric Fence is a debugger that uses virtual memory hardware to detect illegal memory accesses. It can detect two common programming bugs: software that overruns or underruns the boundaries of a malloc() memory allocation, and software that touches a memory allocation that has been released by free(). . Unlike other malloc() debuggers, Electric Fence will detect read accesses as well as writes, and it will stop and pinpoint the exact instruction that causes an error. It is not as thorough as Purify, however. . In order to debug a program it needs to be linked with Electric Fence's library or dynamic linking needs to be used; README.Debian explains that in detail.