Valgrind:

2006-11-02  Soren Sandmann <sandmann@daimi.au.dk>

        Valgrind:

        * binparser.c (bin_parser_free): Add this function

        * elfparser.c (elf_parser_free): Call bin_parser_free()

        * sysprof.c (compute_text_width, add_text): Plug leaks

        * collector.c (add_trace_to_stash): Copy n_addresses to a stack
        variable instead of reading it out of the mmap'ed area all the
        time. (That way if there is an overrun, we won't write too much
        into the address array).
This commit is contained in:
Soren Sandmann
2006-11-02 08:33:35 +00:00
committed by Søren Sandmann Pedersen
parent 9a1ed3d336
commit 0513ed87e8
5 changed files with 40 additions and 4 deletions

View File

@ -1,3 +1,18 @@
2006-11-02 Soren Sandmann <sandmann@daimi.au.dk>
Valgrind:
* binparser.c (bin_parser_free): Add this function
* elfparser.c (elf_parser_free): Call bin_parser_free()
* sysprof.c (compute_text_width, add_text): Plug leaks
* collector.c (add_trace_to_stash): Copy n_addresses to a stack
variable instead of reading it out of the mmap'ed area all the
time. (That way if there is an overrun, we won't write too much
into the address array).
2006-10-26 Soren Sandmann <sandmann@daimi.au.dk>
* module/sysprof-module.h (struct SysprofStackTrace): Increase the

View File

@ -54,6 +54,12 @@ bin_parser_new (const guchar *data,
return parser;
}
void
bin_parser_free (BinParser *parser)
{
g_free (parser);
}
static GQueue *
read_varargs (va_list args,
const char * name,

View File

@ -91,10 +91,13 @@ add_trace_to_stash (const SysprofStackTrace *trace,
int i;
gulong *addrs;
Process *process = process_get_from_pid (trace->pid);
int n_addresses;
addrs = g_new (gulong, trace->n_addresses + 1);
n_addresses = trace->n_addresses;
for (i = 0; i < trace->n_addresses; ++i)
addrs = g_new (gulong, n_addresses + 1);
for (i = 0; i < n_addresses; ++i)
{
process_ensure_map (process, trace->pid,
(gulong)trace->addresses[i]);
@ -105,7 +108,7 @@ add_trace_to_stash (const SysprofStackTrace *trace,
addrs[i] = (gulong)process;
stack_stash_add_trace (
stash, addrs, trace->n_addresses + 1, 1);
stash, addrs, n_addresses + 1, 1);
g_free (addrs);
}
@ -324,7 +327,11 @@ unique_dup (GHashTable *unique_symbols, const char *sym)
static char *
lookup_symbol (Process *process, gpointer address, GHashTable *unique_symbols)
{
const char *sym = process_lookup_symbol (process, (gulong)address);
const char *sym;
g_assert (process);
sym = process_lookup_symbol (process, (gulong)address);
return unique_dup (unique_symbols, sym);
}

View File

@ -315,6 +315,8 @@ elf_parser_free (ElfParser *parser)
if (parser->file)
g_mapped_file_free (parser->file);
bin_parser_free (parser->parser);
g_free (parser);
}

View File

@ -1066,6 +1066,8 @@ compute_text_width (GtkTreeView *view,
get_data (view, iter, &name, NULL, NULL);
*width = MAX (g_utf8_strlen (name, -1) + get_indent (path), *width);
g_free (name);
}
typedef struct
@ -1106,6 +1108,8 @@ add_text (GtkTreeView *view,
g_string_append_c (info->text, ' ');
g_string_append_printf (info->text, "%-*s %6.2f %6.2f\n", info->max_width - indent, name, self, cumulative);
g_free (name);
}
static void
@ -1601,6 +1605,8 @@ main (int argc,
* - caches too much memory
* - is not actually faster
*/
#endif
#if 0
g_slice_set_config (G_SLICE_CONFIG_ALWAYS_MALLOC, TRUE);
#endif