Skip to content

Commit

Permalink
mallinfo is only defined on glibc and android (#764)
Browse files Browse the repository at this point in the history
It currently prevents compilation under musl:

```
[ 90%] Building CXX object src/tbbmalloc_proxy/CMakeFiles/tbbmalloc_proxy.dir/proxy.cpp.o
/__w/mimalloc-bench/mimalloc-bench/extern/tbb/src/tbbmalloc_proxy/proxy.cpp:263:26: error: return type 'struct mallinfo' is incomplete
  263 | struct mallinfo mallinfo() __THROW
      |                          ^
compilation terminated due to -Wfatal-errors.
``
  • Loading branch information
jvoisin authored Feb 7, 2022
1 parent e274a9e commit 3a7f96d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/tbbmalloc_proxy/proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,15 @@ int mallopt(int /*param*/, int /*value*/) __THROW
return 1;
}

#if defined(__GLIBC__) || defined(__ANDROID__)
struct mallinfo mallinfo() __THROW
{
struct mallinfo m;
memset(&m, 0, sizeof(struct mallinfo));

return m;
}
#endif

#if __ANDROID__
// Android doesn't have malloc_usable_size, provide it to be compatible
Expand Down

0 comments on commit 3a7f96d

Please sign in to comment.