mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-11 15:40:53 +00:00
Destroy state object after use, don't keep bin files in map objects
This commit is contained in:
31
tracker.c
31
tracker.c
@ -326,8 +326,6 @@ struct map_t
|
|||||||
uint64_t end;
|
uint64_t end;
|
||||||
uint64_t offset;
|
uint64_t offset;
|
||||||
uint64_t inode;
|
uint64_t inode;
|
||||||
|
|
||||||
BinFile * bin_file;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct state_t
|
struct state_t
|
||||||
@ -341,9 +339,6 @@ struct state_t
|
|||||||
static void
|
static void
|
||||||
destroy_map (map_t *map)
|
destroy_map (map_t *map)
|
||||||
{
|
{
|
||||||
if (map->bin_file)
|
|
||||||
bin_file_free (map->bin_file);
|
|
||||||
|
|
||||||
g_free (map->filename);
|
g_free (map->filename);
|
||||||
g_free (map);
|
g_free (map);
|
||||||
}
|
}
|
||||||
@ -441,6 +436,17 @@ state_new (void)
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
state_free (state_t *state)
|
||||||
|
{
|
||||||
|
g_hash_table_destroy (state->processes_by_pid);
|
||||||
|
g_hash_table_destroy (state->unique_symbols);
|
||||||
|
g_hash_table_destroy (state->unique_comms);
|
||||||
|
g_hash_table_destroy (state->bin_files);
|
||||||
|
|
||||||
|
g_free (state);
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
gulong address;
|
gulong address;
|
||||||
@ -708,15 +714,13 @@ lookup_symbol (state_t *state,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
BinFile *bin_file = state_get_bin_file (state, map->filename);
|
||||||
const BinSymbol *bin_sym;
|
const BinSymbol *bin_sym;
|
||||||
|
|
||||||
address -= map->start;
|
address -= map->start;
|
||||||
address += map->offset;
|
address += map->offset;
|
||||||
|
|
||||||
if (!map->bin_file)
|
if (map->inode && !bin_file_check_inode (bin_file, map->inode))
|
||||||
map->bin_file = state_get_bin_file (state, map->filename);
|
|
||||||
|
|
||||||
if (map->inode && !bin_file_check_inode (map->bin_file, map->inode))
|
|
||||||
{
|
{
|
||||||
/* If the inodes don't match, it's probably because the
|
/* If the inodes don't match, it's probably because the
|
||||||
* file has changed since the process was started.
|
* file has changed since the process was started.
|
||||||
@ -725,9 +729,9 @@ lookup_symbol (state_t *state,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bin_sym = bin_file_lookup_symbol (map->bin_file, address);
|
bin_sym = bin_file_lookup_symbol (bin_file, address);
|
||||||
|
|
||||||
sym = bin_symbol_get_name (map->bin_file, bin_sym);
|
sym = bin_symbol_get_name (bin_file, bin_sym);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -879,7 +883,8 @@ tracker_create_profile (tracker_t *tracker)
|
|||||||
}
|
}
|
||||||
|
|
||||||
profile = profile_new (resolved_stash);
|
profile = profile_new (resolved_stash);
|
||||||
|
|
||||||
|
state_free (state);
|
||||||
stack_stash_unref (resolved_stash);
|
stack_stash_unref (resolved_stash);
|
||||||
|
|
||||||
return profile;
|
return profile;
|
||||||
|
|||||||
Reference in New Issue
Block a user