Avoid allocation when storing jemalloc profile name#87149
Merged
Conversation
Contributor
|
Workflow [PR], commit [0ba634a] Summary: ❌
|
antonio2368
commented
Sep 16, 2025
azat
reviewed
Sep 16, 2025
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
azat
approved these changes
Sep 16, 2025
Member
azat
left a comment
There was a problem hiding this comment.
LGTM
Also, it looks like we can update the callers of flushProfile, i.e.
$ git di
diff --git a/src/Coordination/FourLetterCommand.cpp b/src/Coordination/FourLetterCommand.cpp
index e7ed119c0cc..02e5d4d1daf 100644
--- a/src/Coordination/FourLetterCommand.cpp
+++ b/src/Coordination/FourLetterCommand.cpp
@@ -652,8 +652,8 @@ String JemallocDumpStats::run()
String JemallocFlushProfile::run()
{
- Jemalloc::flushProfile("/tmp/jemalloc_keeper");
- return std::string{Jemalloc::getLastFlushProfileForThread()};
+ auto profile_path = Jemalloc::flushProfile("/tmp/jemalloc_keeper");
+ return profile_path;
}
String JemallocEnableProfile::run()
diff --git a/src/Interpreters/InterpreterSystemQuery.cpp b/src/Interpreters/InterpreterSystemQuery.cpp
index df806db9eee..a137483b8a0 100644
--- a/src/Interpreters/InterpreterSystemQuery.cpp
+++ b/src/Interpreters/InterpreterSystemQuery.cpp
@@ -915,10 +915,9 @@ BlockIO InterpreterSystemQuery::execute()
case Type::JEMALLOC_FLUSH_PROFILE:
{
getContext()->checkAccess(AccessType::SYSTEM_JEMALLOC);
- Jemalloc::flushProfile(query.jemalloc_profile_path.empty() ? "/tmp/jemalloc_clickhouse" : query.jemalloc_profile_path);
- auto filename = Jemalloc::getLastFlushProfileForThread();
+ auto profile_path = Jemalloc::flushProfile(query.jemalloc_profile_path.empty() ? "/tmp/jemalloc_clickhouse" : query.jemalloc_profile_path);
auto col = ColumnString::create();
- col->insertData(filename.data(), filename.size());
+ col->insertData(profile_path.data(), profile_path.size());
Columns columns;
columns.emplace_back(std::move(col));
Chunk chunk(std::move(columns), 1);
Member
|
I need this changes to avoid conflicts, merging. CI is unrelated (fixed in #87339) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
We cannot allocate in MemoryTracker in all cases.
https://github.com/ClickHouse/clickhouse-private/issues/38064
Documentation entry for user-facing changes