musl: base: Remove use of mallinfo

This commit is contained in:
klzgrad
2019-11-30 22:36:22 +08:00
parent 22bafe776e
commit b54c1e2154
2 changed files with 6 additions and 1 deletions

View File

@ -112,6 +112,9 @@ void IncreaseFdLimitTo(unsigned int max_descriptors) {
namespace {
size_t GetMallocUsageMallinfo() {
#if defined(__MUSL__)
return 0;
#else
#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
#if __GLIBC_PREREQ(2, 33)
#define MALLINFO2_FOUND_IN_LIBC
@ -123,6 +126,7 @@ size_t GetMallocUsageMallinfo() {
#endif
#undef MALLINFO2_FOUND_IN_LIBC
return checked_cast<size_t>(minfo.hblkhd + minfo.arena);
#endif
}
} // namespace

View File

@ -180,7 +180,7 @@ void ReportAppleAllocStats(size_t* total_virtual_size,
#if (PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && BUILDFLAG(IS_ANDROID)) || \
(!PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && !BUILDFLAG(IS_WIN) && \
!BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_FUCHSIA))
!BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_FUCHSIA) && !defined(__MUSL__))
void ReportMallinfoStats(ProcessMemoryDump* pmd,
size_t* total_virtual_size,
size_t* resident_size,
@ -383,6 +383,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
&allocated_objects_count);
#elif BUILDFLAG(IS_FUCHSIA)
// TODO(fuchsia): Port, see https://crbug.com/706592.
#elif defined(__MUSL__)
#else
ReportMallinfoStats(/*pmd=*/nullptr, &total_virtual_size, &resident_size,
&allocated_objects_size, &allocated_objects_count);