Can you recommend a good malloc debugging library for Linux?

Can you recommend a good malloc debugging library for Linux? I know that there are many options, I just need to know which libraries people use to solve real problems.

Thanks!

EDIT: I know about Valgrind, but sometimes the performance is very low.

+4
source share
5 answers

Gcc currently comes with disinfectants that are much faster than valgrind. you can check various compiler options under -fsanitize. More info here

+1
source

Valgrind . :-) This is not a malloc library, but it is really good at finding errors in memory and memory usage errors.

+5
source

http://valgrind.org/ for finding memory leaks and heap corruption.

http://dmalloc.com/ for general-purpose heap debugging.

+5
source

The GNU C library itself has some debugging and hooking functions that you can use to add your own.

For documentation on the Linux system type info libc , followed by g Heap<TAB> . Another useful node information is โ€œHooks for Malloc,โ€ you can get there g Hooks<TAB>

+2
source

This may not be very useful for you, but you can write your own malloc shell. In our special โ€œdiagnosticโ€ assemblies, it stores a table of all outstanding distributions (including the file name and line number where the distribution occurred), and displays everything that was still outstanding at the time of exit. It also uses the words canary (to check for buffer overflows) and a combination of rewriting memory and blocking checksums after free and before reallocation (to check after-work usage).

If your product is large enough, it can be frustrating to find - replace your entire source, hoping for the best. Also, the development time for your own malloc shell is probably not insignificant. Doing a lot of heavy things like what I mentioned above probably also will not help solve your speed problem. However, writing your own shell can provide maximum flexibility.

+1
source

Source: https://habr.com/ru/post/1303245/


All Articles