GNOME Bugzilla – Bug 319557
loading dl modules should always be lazy on Solaris
Last modified: 2005-10-27 03:52:21 UTC
Distribution/Version: 5.x ... not sure about other platforms. Quote from dlopen(3C) on Solaris: RTLD_LAZY Only immediate symbol references are relo- cated when the object is first loaded. Lazy references are not relocated until a given function is called for the first time. This value for mode should improve performance, since a process might not require all lazy references in any given object. This behavior mimics the normal loading of depen- dencies during process initialization. See NOTES. RTLD_NOW All necessary relocations are performed when the object is first loaded. This process might waste some processing if relocations are performed for lazy references that are never used. However, this mode ensures that when an object is loaded, all symbols refer- enced during execution are available. This behavior mimics the loading of dependencies when the environment variable LD_BIND_NOW is in effect. Some modules, for example gtk theme engines are opened with g_module_open(..., 0), which means RTLD_NOW is used in the dlopen call. This causes a noticable performance hit at the startup of of large applications, such as firefox. The attached patch makes g_module_open to always use RTLD_LAZY on Solaris. One may argue that the calls to g_module_open should be fixed, but it seems that RTLD_NOW is never the right thing to do when opening modules.
Created attachment 53809 [details] [review] force lazy loading of dl modules on solaris
I think we should just make GTK+ use G_MODULE_BIND_LAZY
2005-10-26 Matthias Clasen <mclasen@redhat.com> * gtk/gtkfilesystem.c (gtk_file_system_module_load): * gtk/gtkthemes.c (gtk_theme_engine_load): * gtk/gtkimmodule.c (gtk_im_module_load): Use G_MODULE_BIND_LAZY when dlopening modules. (#319557, Laszlo Peter)
hmm... fair enough, but then there are loads of other calls that need to be fixed too. I'll file individual bug reports. Unfortunately, while any one of those is not fixed, we're haven't achieved anything. Other g_module_open (foo, 0) calls in gtk+: gtk/gtkimmodule.c gtk/gtkfilesystem.c There are about 30 more throughout the GNOME stack, including 1 in pango, 1 in libglade, 1 in gconf. These are probably the most critical ones.
I have changed all calls in GTK+, and I can probably convince Behdad to fix the on e in Pango. It might be worth posting this information to the new performance-list, to get some janitorial effort going.