libyama

libyama is a malloc implementation that bundles leak tracking by auditing allocations.
Download

libyama Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Freely Distributable
  • Price:
  • FREE
  • Publisher Name:
  • Venkatesha Murthy G
  • Publisher web site:
  • http://personal.pavanashree.org/libyama/

libyama Tags


libyama Description

libyama is a malloc implementation that bundles leak tracking by auditing allocations. libyama is a malloc implementation that bundles leak tracking by auditing allocations, array bound write detection, detection of access to free'd memory, free/realloc on invalid pointers. It grew out of an attempt to build array bound overwrite detection into LeakTrac, a leak tracker I wrote earlier.Since LeakTrac performed only book keeping and not any allocation, it was not possible to make LeakTrac detect array bound write, hence an allocator that does; and also tracks leaks.You can think of it as merging LeakTrac and code that was inspired by ElectricFence.If you only want to track leaks, then LeakTrac is just what you need. If you want an allocator that lets you debug also, then YaMa is the one for you. Sure, there are other similar things on the block - which is why this is Yet another Memory allocator.Here are some key features of "libyama":· provides malloc, calloc, realloc and free· tracks and reports leaks· detects accesses beyond allocated memory· detects accesses to free'd memory· detects free on non-malloc'ed pointers, NULL pointers· detects realloc on non-malloc'ed pointersInstallation:Currently YaMa is written for Linux x86. You'll need a kernel that provides mmap etc, and gcc that can build ELF shared libraries. You also need to install binutils, if you haven't already (very unlikely) And you'll need the /proc filesystem. To install YaMa Unpack the archiveEdit Makefile; the only things you need to change are INSTALLDIR and BT. make lib to makemake install to install. You'll need write permission on INSTALLDIR.You may need to run ldconfigUsage:YaMa contains libyama.so, a shared library installed into INSTALLDIR by make install. The library provides malloc, calloc, realloc and free which can be used as replacements to their libc implementations. A program can be linked against libyama on the command line (-lyama). A more interesting way to use libyama would be to preload it using LD_PRELOAD. The command line LD_PRELOAD=libyama.so would cause all calls to malloc, calloc, realloc and free originating from the program being run to be handled by the YaMa implementation. If libyama.so doesn't show up on ldconfig -p or it is not on your LD_LIBRARY_PATH, you need to specify the full path length. When the program errs by accessing memory across an array bound, i.e, beyond the memory allocated using malloc/calloc/realloc, it receives a SIGSEGV. An access to free'd memory also results in a SIGSEGV. If you've compiled your program using -g, you can locate the offending statement using any debugger on the core file. Note that overwrites on statically allocated arrays are not detected by YaMa. If the program peforms an invalid free or realloc, an "Alert!" message is written to stderr, along with the call chain till the free/realloc. The call fails.Upon normal program termination, either thro' exit or return from main, a summary of leaks is printed on stderr. The size of each chunk of memory that remains un-free'd at the end of the program is reported, along with the call chain till the allocation.The behaviour of YaMa on malloc (0) (or calloc (x, 0)) is controlled by the environment variable ALLOWMALLOCZERO. If this variable is set to values = 2, YaMa returns a valid pointer and no warning is printed. Writes to this pointer, too, will fail. If ALLOWMALLOCZERO is not set, the behaviour is identical to ALLOWMALLOCZERO = 0. What's New in This Release:· Fixed a bug in the stack backtrace code which would crash libyama. Compile time control of backtracing (I've found it useful at times not to have tracing).


libyama Related Software