[lvm-devel] lvm and locales memory issue

Alasdair G Kergon agk at redhat.com
Tue Feb 23 16:53:30 UTC 2010


On Tue, Feb 23, 2010 at 05:28:42PM +0100, Jakub Jelinek wrote:
>   for (i = 0; i < 1000000; i++)
>     switch (i % 5)
>       {
>       case 0: setlocale (LC_ALL, "C"); break;
>       case 1: setlocale (LC_ALL, "en_US.UTF-8"); break;
>       case 2: setlocale (LC_ALL, "cs_CZ.UTF-8"); break;
>       case 3: setlocale (LC_ALL, "fr_FR.UTF-8"); break;
>       case 4: setlocale (LC_ALL, "de_DE.UTF-8"); break;
>       }
>   return 0;
> }
> 
> As this is something almost
> every program calls at least once, it is not a good idea to slow this down
> completely unnecessarily.
 
Indeed - but lvm only calls this once, not a million times, so I'm afraid it's
the wrong optimisation for us.  Locale-based functions are anyway not used in
our performance-critical code paths.

An 80-90% saving on the memory footprint is a much more important consideration
for us.

Alasdair




More information about the lvm-devel mailing list