[pulse] Add unreachable point to the trace of memory leaks

Summary: When looking at some reports I realised that adding the place where the memory becomes unreachable to the trace makes it more readable.

Reviewed By: skcho

Differential Revision: D20790277

fbshipit-source-id: d5df69e68
master
Dulma Churchill 5 years ago committed by Facebook GitHub Bot
parent 46269eb891
commit 902514dccd

@ -110,13 +110,13 @@ let get_trace = function
~pp_immediate:(fun fmt -> F.pp_print_string fmt "invalid access occurs here") ~pp_immediate:(fun fmt -> F.pp_print_string fmt "invalid access occurs here")
access_trace access_trace
@@ [] @@ []
| MemoryLeak {allocation_trace} -> | MemoryLeak {location; allocation_trace} ->
let access_start_location = Trace.get_start_location allocation_trace in let access_start_location = Trace.get_start_location allocation_trace in
add_errlog_header ~title:"allocation part of the trace starts here" access_start_location add_errlog_header ~title:"allocation part of the trace starts here" access_start_location
@@ Trace.add_to_errlog ~nesting:0 @@ Trace.add_to_errlog ~nesting:0
~pp_immediate:(fun fmt -> F.pp_print_string fmt "allocation occurs here") ~pp_immediate:(fun fmt -> F.pp_print_string fmt "allocation occurs here")
allocation_trace allocation_trace
@@ [] @@ [Errlog.make_trace_element 0 location "memory becomes unreachable here" []]
| StackVariableAddressEscape {history; location; _} -> | StackVariableAddressEscape {history; location; _} ->
ValueHistory.add_to_errlog ~nesting:0 history ValueHistory.add_to_errlog ~nesting:0 history
@@ @@

@ -1,3 +1,3 @@
codetoanalyze/c/pulse/memory_leak.c, malloc_interproc_no_free_bad, 0, PULSE_MEMORY_LEAK, no_bucket, ERROR, [allocation part of the trace starts here,when calling `create_p` here,allocation occurs here] codetoanalyze/c/pulse/memory_leak.c, malloc_interproc_no_free_bad, 0, PULSE_MEMORY_LEAK, no_bucket, ERROR, [allocation part of the trace starts here,when calling `create_p` here,allocation occurs here,memory becomes unreachable here]
codetoanalyze/c/pulse/memory_leak.c, malloc_interproc_no_free_bad2, 4, PULSE_MEMORY_LEAK, no_bucket, ERROR, [allocation part of the trace starts here,allocation occurs here] codetoanalyze/c/pulse/memory_leak.c, malloc_interproc_no_free_bad2, 4, PULSE_MEMORY_LEAK, no_bucket, ERROR, [allocation part of the trace starts here,allocation occurs here,memory becomes unreachable here]
codetoanalyze/c/pulse/memory_leak.c, malloc_no_free_bad, 0, PULSE_MEMORY_LEAK, no_bucket, ERROR, [allocation part of the trace starts here,allocation occurs here] codetoanalyze/c/pulse/memory_leak.c, malloc_no_free_bad, 0, PULSE_MEMORY_LEAK, no_bucket, ERROR, [allocation part of the trace starts here,allocation occurs here,memory becomes unreachable here]

Loading…
Cancel
Save