Skip to content
Snippets Groups Projects
  • Nadav Har'El's avatar
    94d08688
    Added rudimentary leak detection · 94d08688
    Nadav Har'El authored
    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.
    94d08688
    History
    Added rudimentary leak detection
    Nadav Har'El authored
    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.