2 * talloc_report into a FILE
4 * Copyright Volker Lendecke <vl@samba.org> 2015
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "talloc_report_printf.h"
23 static void talloc_report_printf_helper(
30 FILE *f
= private_data
;
31 const char *name
= talloc_get_name(ptr
);
35 "%*sreference to: %s\n",
44 "%stalloc report on '%s' "
45 "(total %6zu bytes in %3zu blocks)\n",
46 (max_depth
< 0 ? "full " :""), name
,
47 talloc_total_size(ptr
),
48 talloc_total_blocks(ptr
));
52 if (strcmp(name
, "char") == 0) {
54 * Print out the first 50 bytes of the string
57 "%*s%-30s contains %6zu bytes in %3zu blocks "
58 "(ref %zu): %*s\n", depth
*4, "", name
,
59 talloc_total_size(ptr
),
60 talloc_total_blocks(ptr
),
61 talloc_reference_count(ptr
),
62 (int)MIN(50, talloc_get_size(ptr
)),
68 "%*s%-30s contains %6zu bytes in %3zu blocks (ref %zu) %p\n",
70 talloc_total_size(ptr
),
71 talloc_total_blocks(ptr
),
72 talloc_reference_count(ptr
),
76 void talloc_full_report_printf(TALLOC_CTX
*root
, FILE *f
)
78 talloc_report_depth_cb(root
, 0, -1, talloc_report_printf_helper
, f
);
108 #endif /* HAVE_MALLINFO */