mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-08 11:59:48 -04:00
refactor: make sure jemalloc version in always initialized
This commit is contained in:
parent
bdb5469b7b
commit
807dbb9aef
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
@ -56,13 +57,14 @@ std::string version_to_string(uint64_t version, version_format fmt) {
|
||||
|
||||
#ifdef DWARFS_USE_JEMALLOC
|
||||
std::string get_jemalloc_version() {
|
||||
char const* j;
|
||||
#ifdef __APPLE__
|
||||
j = JEMALLOC_VERSION;
|
||||
char const* j = JEMALLOC_VERSION;
|
||||
#else
|
||||
char const* j = nullptr;
|
||||
size_t s = sizeof(j);
|
||||
// NOLINTNEXTLINE(bugprone-multi-level-implicit-pointer-conversion)
|
||||
::mallctl("version", &j, &s, nullptr, 0);
|
||||
assert(j);
|
||||
#endif
|
||||
std::string rv{j};
|
||||
if (auto pos = rv.find('-'); pos != std::string::npos) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user