4 ms·
Can this be configured at runtime using an environment variable? It would be nice to test for bugs like this in dev.
by nodata 15y ago
Can this be configured at runtime using an environment variable? It would be nice to test for bugs like this in dev.
- pmjordan 15y agoYou could easily do this on Linux, where the executable format allows you to override library-defined symbols, including malloc(). Implement the new malloc/calloc/realloc/free as a static library and link it to your dev builds. Don't link it for releases. Or just use valgrind, if you can.
- piotrSikora 15y agoYou seem to miss the difference between "developer testing his/her app" and "everyone testing every app". To the point, I'm using "/etc/malloc.conf -> AFGJPRX" on most of my systems, which means that virtually everything that runs there is checked. Can you easily do that on Linux? How many apps are you running via valgrind on a daily basis?
- lflux 15y agoYes, by setting the MALLOC_OPTIONS environment variable. See http://www.openbsd.org/cgi-bin/man.cgi?query=malloc http://www.openbsd.org/cgi-bin/man.cgi?query=malloc