thread stack size



Hi all,

I'm trying to figure out why gthumb uses so much memory, even when it is displaying an empty folder. I've figured out that it is launching 6-8 threads, which each consume 10 MB each of "writeable/private" memory. pmap -d shows:

mapped: 141352K    writeable/private: 76352K    shared: 516K

If I patch the code to use 64k stack size for new threads, like this:

- priv->thread = g_thread_create (load_image_thread, il, TRUE, NULL);
+ priv->thread = g_thread_create_full (load_image_thread, il, 65536, TRUE, FALSE, G_THREAD_PRIORITY_NORMAL, NULL);

memory consumption drops dramatically (and the program still works):

mapped: 91284K    writeable/private: 25872K    shared: 516K

(There are still 2-3 10MB stacks that I don't understand fully yet).

The gnome api says "Only use g_thread_create_full() if you really can't use g_thread_create() instead". Why not? Are there any real downsides here?


- Mike



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