Resurrect this function.

Sun Jan  8 03:22:22 2006  Soeren Sandmann  <sandmann@redhat.com>

	* process.c (process_flush_caches): Resurrect this function.

	* collector.c (collector_reset): Call it from here
This commit is contained in:
Soeren Sandmann
2006-01-08 08:22:47 +00:00
committed by Søren Sandmann Pedersen
parent 0559ad82e7
commit 5a8582b041
4 changed files with 49 additions and 1 deletions

View File

@ -1,3 +1,9 @@
Sun Jan 8 03:22:22 2006 Soeren Sandmann <sandmann@redhat.com>
* process.c (process_flush_caches): Resurrect this function.
* collector.c (collector_reset): Call it from here
Sun Jan 8 02:19:34 2006 Soeren Sandmann <sandmann@redhat.com>
* TODO: update

View File

@ -240,6 +240,8 @@ collector_reset (Collector *collector)
{
if (collector->stash)
stack_stash_free (collector->stash);
process_flush_caches();
collector->stash = stack_stash_new ();
collector->n_samples = 0;

View File

@ -200,6 +200,44 @@ process_free_maps (Process *process)
g_list_free (process->maps);
}
static void
free_process (gpointer key, gpointer value, gpointer data)
{
char *cmdline = key;
Process *process = value;
#if 0
g_print ("freeing: %p\n", process);
memset (process, '\0', sizeof (Process));
#endif
g_free (process->cmdline);
#if 0
process->cmdline = "You are using free()'d memory";
#endif
process_free_maps (process);
g_list_free (process->bad_pages);
g_free (cmdline);
g_free (process);
}
void
process_flush_caches (void)
{
if (!processes_by_cmdline)
return;
g_hash_table_foreach (processes_by_cmdline, free_process, NULL);
g_hash_table_destroy (processes_by_cmdline);
g_hash_table_destroy (processes_by_pid);
processes_by_cmdline = NULL;
processes_by_pid = NULL;
}
static gboolean
process_has_page (Process *process, gulong addr)
{
@ -343,6 +381,8 @@ process_get_from_pid (int pid)
return p;
}
#include <sys/utsname.h>
#include <sys/types.h>
#include <sys/stat.h>

View File

@ -59,6 +59,6 @@ const Symbol *process_lookup_symbol_with_filename (Process *process,
const char *filename,
gulong address);
const char * process_get_cmdline (Process *process);
void process_flush_caches (void);
#endif