[llvm-bugs] [Bug 44387] New: memory leak in locale.cpp

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 27 06:17:42 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=44387

            Bug ID: 44387
           Summary: memory leak in locale.cpp
           Product: libc++
           Version: unspecified
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Standards Issues
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gavin.chang1380 at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

I am locating a memory leak problem about Android NDK shared library. When I
dlopen libc++_shared.so(which is the same with libc++.so) and dlclose it, there
will be an 8 bytes memory leak. And when I dlopen and dlclose it again, there
will be another 8 bytes memory leak.

And I find the leak is in the locale.cpp file.

In locale.cpp:
locale_t __cloc() {
// In theory this could create a race condition. In practice
// the race condition is non-fatal since it will just create
// a little resource leak. Better approach would be appreciated.
static locale_t result = newlocale(LC_ALL_MASK, "C", 0);
return result;
}

The variable 'result' will be allocated a locale object and never free.

Is it a memory leak bug?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191227/1a161d13/attachment.html>


More information about the llvm-bugs mailing list