Skip to content

Is there a memory leak in locale.cpp? #82

Closed
@gavinchang1380

Description

@gavinchang1380

I am locating a memory leak problem about Android NDK shared library. When I dlopen a shared library 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 libc++.so, in 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;
}

And the os will malloc 8 bytes without free.

Is it a memory leak bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions