mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
MINOR: memprof: report the delta between alloc and free on realloc()
realloc() calls are painful to analyse because they have two non-zero columns and trying to spot a leaking one requires a bit of scripting. Let's simply append the delta at the end of the line when alloc and free are non-nul. It would be useful to backport this to 2.4 to help with bug reports.
This commit is contained in:
parent
a5efdff93c
commit
8cce4d79ff
@ -737,9 +737,16 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
|
|||||||
else
|
else
|
||||||
chunk_appendf(&trash, "[other]");
|
chunk_appendf(&trash, "[other]");
|
||||||
|
|
||||||
chunk_appendf(&trash," %s(%lld)\n", memprof_methods[entry->method],
|
chunk_appendf(&trash," %s(%lld)", memprof_methods[entry->method],
|
||||||
(long long)(entry->alloc_tot - entry->free_tot) / (long long)(entry->alloc_calls + entry->free_calls));
|
(long long)(entry->alloc_tot - entry->free_tot) / (long long)(entry->alloc_calls + entry->free_calls));
|
||||||
|
|
||||||
|
if (entry->alloc_tot && entry->free_tot) {
|
||||||
|
/* that's a realloc, show the total diff to help spot leaks */
|
||||||
|
chunk_appendf(&trash," [delta=%lld]", (long long)(entry->alloc_tot - entry->free_tot));
|
||||||
|
}
|
||||||
|
|
||||||
|
chunk_appendf(&trash, "\n");
|
||||||
|
|
||||||
if (ci_putchk(si_ic(si), &trash) == -1) {
|
if (ci_putchk(si_ic(si), &trash) == -1) {
|
||||||
si_rx_room_blk(si);
|
si_rx_room_blk(si);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user