Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Sep 2020 01:33:46 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 249416] Each call to newlocale(3) with a non-null base argument results in additional memory usage
Message-ID:  <bug-249416-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=249416

            Bug ID: 249416
           Summary: Each call to newlocale(3) with a non-null base
                    argument results in additional memory usage
           Product: Base System
           Version: 12.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: leres@freebsd.org
 Attachment #218038 text/plain
         mime type:

Created attachment 218038
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=218038&action=edit
newlocale() test program

There appears to be a memory usage issue with newlocale(3) when called with a
base argument. This recently started showing symptoms in devel/json-c programs
using version 0.14 and higher which started using newlocale() due to a change
in the cmake configuration. Here is the devel/json-c PR:

    https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=249412

Here is the upstream ticket I created:

    https://github.com/json-c/json-c/issues/668

Eric Hawicz responded, suggesting that FreeBSD's implementation of newlocale()
might be causing the issue. His helpful test program confirms this. Attached to
this PR is a modified version that uses sysctl() to automatically track and
report changes to rss and vsz.

Eric points out that FreeBSD and linux man pages describe different behavior;
FreeBSD:

   
https://www.freebsd.org/cgi/man.cgi?query=newlocale&sektion=3&manpath=freebsd-release-ports
    "Creates a new locale, inheriting some properties from an existing locale."

Note that there do not appear to be uses of newlocale() with a non-null base
argument in the current source tree; linux:

    https://man7.org/linux/man-pages/man3/newlocale.3.html
    "The newlocale() function creates a new locale object, or modifies an
existing object..."

And that posix says:

    https://pubs.opengroup.org/onlinepubs/9699919799/functions/newlocale.html
    "The newlocale() function shall create a new locale object or modify an
existing one."

I did some testing with versions of lib/libc/locale going back to 2012 and all
had this issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.

help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-249416-227>