mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-08 20:12:56 -04:00
fix: mallctl("version", ...) crashes on macOS
This commit is contained in:
parent
dadc2e0254
commit
5d4017de4f
@ -53,9 +53,13 @@ std::string version_to_string(uint64_t version, version_format fmt) {
|
||||
|
||||
#ifdef DWARFS_USE_JEMALLOC
|
||||
std::string get_jemalloc_version() {
|
||||
const char* j;
|
||||
char const* j;
|
||||
#ifdef __APPLE__
|
||||
j = JEMALLOC_VERSION;
|
||||
#else
|
||||
size_t s = sizeof(j);
|
||||
::mallctl("version", &j, &s, nullptr, 0);
|
||||
#endif
|
||||
std::string rv{j};
|
||||
if (auto pos = rv.find('-'); pos != std::string::npos) {
|
||||
rv.erase(pos, std::string::npos);
|
||||
|
Loading…
x
Reference in New Issue
Block a user