New function

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

       * sysprof.c (disable_g_slice): New function

       * sysprof.c (main): Call it from here.
This commit is contained in:
Soren Sandmann
2006-11-11 03:34:40 +00:00
committed by Søren Sandmann Pedersen
parent abb66e7dc7
commit 55fc6d7805
4 changed files with 28 additions and 115 deletions

View File

@ -1587,29 +1587,38 @@ process_options (int argc,
return filename;
}
static void
disable_g_slice (void)
{
/* Disable gslice, since it
*
* - confuses valgrind
* - caches too much memory
* - hides memory access bugs
* - is not faster than malloc
*
* Note that g_slice_set_config() is broken in some versions of
* GLib (and 'declared internal' according to Tim), so we use the
* environment variable instead.
*/
if (!getenv ("G_SLICE"))
putenv ("G_SLICE=always_malloc");
}
int
main (int argc,
char **argv)
{
Application *app;
const char *filename;
disable_g_slice();
filename = process_options (argc, argv);
gtk_init (&argc, &argv);
#if 0
/* FIXME: enable this when compiled against the relevant glib
* version. The reason we want to disable it is that gslice
* - confuses valgrind
* - caches too much memory
* - is not actually faster
*/
#endif
#if 0
g_slice_set_config (G_SLICE_CONFIG_ALWAYS_MALLOC, TRUE);
#endif
app = application_new ();
if (!build_gui (app))