> Who knows the usage of nspr_use_zone_allocator. In
> http://lxr.mozilla.org/seamonkey/source/nsprpub/pr/src/malloc/prmem.c#186 > PR_InitZones() tries to load symbol "nspr_use_zone_allocator" which is
> not defined anywhere. This will chose Mozilla to load many shared
> libraries which will increase Mozilla startup time.
> I think this option is not necessary. Can anyone tell me what is it
> used for?
nspr_use_zone_allocator is indeed a global variable that you
can define in a dll/main program. If it is defined and has
the value PR_TRUE, NSPR will use the zone allocator, i.e., the stuff in
On the other hand, if it is not defined or has the value PR_FALSE,
NSPR will simply use the regular malloc, calloc, and free in libc.
> If you want to make the load-time fast (with current NSPR) as-in,
> without ever loading the other run-time-dependancies, define that
> [external symbol], with nothing more than a return of a true value.
Brian reported that it is the act of checking that symbol that
causes Mozilla to load many shared libraries. So whether the
symbol is defined or not doesn't matter to the load time.
It calls dlopen with the magic pathname 0. That shouldn't
cause Mozilla to load anything new.
zone allocator is an alternate memory allocator. By default
NSPR uses libc's malloc, calloc, and free. You can tell NSPR
to use the zone allocator by defining the nspr_use_zone_allocator
global variable in your program or setting the
NSPR_USE_ZONE_ALLOCATOR environment variable.