Skip to content
Snippets Groups Projects
Commit 94d08688 authored by Nadav Har'El's avatar Nadav Har'El
Browse files

Added rudimentary leak detection

Added rudimentary support for leak detection. When memory::tracker_enabled
is true, an alloc_tracker object (see alloctracker.{cc,hh}) object keeps
track of still-living memory allocations and the call chain that led to each.
Using a new command in gdb, "osv leak show", a developer can analyze the
remaining allocations, with the aim of finding memory leaks (noticing that
memory leaks often result in repeptitive allocations from the same call chain).

This implementation is a good start (and already found 8 leaks in our code),
but it's far from being perfect. It severely slows down the workload, the
analysis in gdb is not yet friendly enough (requiring manual inspection to
look for the more serious leaks), and the backtrace() implementation also
appears to be fragile: In more than one occasion, we noticed a yet-unexplained
crash when backtrace() unwinds the stack, calls dl_iterate_hphdr() which throws
exception and unwinds the stack again. So this code will probably need more
work in the future.
parent 741c05b2
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment