Re: memory profiling (was calling g_malloc & co via a vtable)



on 10/4/00 9:41 AM, otaylor redhat com at otaylor redhat com wrote:

> Basically, using atexit is evil, because the
> order of various atexit() calls is undefined,

Not true. The atexit functions run in the reverse order they were queued.
I've been using it in Nautilus and it's working great.

> because it interacts badly with fork()

Nautilus code always uses _exit in forks; I didn't understand why before
this, but I assume this is why.

> etc.

I'd like to hear about the etc. I was surprised that this approach worked as
well as it has, but it is working fine and I don't know of major drabacks.

> I'd like to get rid of the current atexit that GDK installs.

It would make my leak checker work less well.

> We could probably add a call to free the free lists,
> (g_flush_unused()) or something like that.
>
> We could also add some sort of gtk_uninit(), though it would be
> a pain to get right.

That would probably work even for fans of atexit like me, since I can just
call g_atexit (gtk_uninit).

I've done this atexit approach a lot with nautilus and gnome-vfs code and
it's working great.

    -- Darin





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]