Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: Fix USE_JEMALLOC macro #9083

Merged
merged 4 commits into from
May 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions dbms/src/Common/MemoryAllocTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@
#include <common/config_common.h> // Included for `USE_JEMALLOC`

#ifdef USE_JEMALLOC
#if USE_JEMALLOC == 1
Copy link
Contributor

@yibin87 yibin87 May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get the point. Why add "#if USE_JEMALLOC == 1" works here? It seems limit the scenarios that include jemalloc head file.

Copy link
Member Author

@CalvinNeo CalvinNeo May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it could be 0, that's why the compile fails
image

#include <jemalloc/jemalloc.h>
#endif
#endif
CalvinNeo marked this conversation as resolved.
Show resolved Hide resolved

namespace DB
{
std::tuple<uint64_t *, uint64_t *> getAllocDeallocPtr()
{
#ifdef USE_JEMALLOC
#if USE_JEMALLOC == 1
CalvinNeo marked this conversation as resolved.
Show resolved Hide resolved
uint64_t * ptr1 = nullptr;
uint64_t size1 = sizeof ptr1;
je_mallctl("thread.allocatedp", reinterpret_cast<void *>(&ptr1), &size1, nullptr, 0);
Expand All @@ -34,5 +37,8 @@ std::tuple<uint64_t *, uint64_t *> getAllocDeallocPtr()
#else
return std::make_tuple(nullptr, nullptr);
#endif
#else
return std::make_tuple(nullptr, nullptr);
#endif
CalvinNeo marked this conversation as resolved.
Show resolved Hide resolved
}
} // namespace DB