Skip to content

Commit 59ea09d

Browse files
Aleksey Ignatievapolukhin
authored andcommitted
feat build: fix jemalloc memory profile running
Try to enable jemalloc memory profiling using guide: [memory_profile_running_service.md](https://github.com/userver-framework/userver/blob/develop/scripts/docs/en/userver/memory_profile_running_service.md) There are two errors: - setting `USERVER_FEATURE_JEMALLOC=ON` doesn't cause `USERVER_FEATURE_JEMALLOC_ENABLED` macros being defined for handler source file: https://github.com/userver-framework/userver/blob/develop/core/src/server/handlers/jemalloc.cpp#L51 -> handler response "jemalloc is not available" even with `USERVER_FEATURE_JEMALLOC` - Function name `IsProfilingEnabledViaEnv` has been changed Tests: протестировано CI Pull Request resolved: #840 commit_hash:14a4fc434ae9835d37d89fed63935f9978cf7fa1
1 parent a4f3958 commit 59ea09d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ endif()
9393
# https://github.com/jemalloc/jemalloc/issues/820
9494
if (USERVER_FEATURE_JEMALLOC AND NOT USERVER_SANITIZE AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
9595
set_property(
96-
SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/utils/jemalloc.cpp
96+
SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/utils/jemalloc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/server/handlers/jemalloc.cpp
9797
APPEND PROPERTY COMPILE_FLAGS -DUSERVER_FEATURE_JEMALLOC_ENABLED=1
9898
)
9999
endif()

core/src/server/handlers/jemalloc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ std::string Jemalloc::HandleRequestThrow(const http::HttpRequest& request, reque
6060
case Command::kStat:
6161
return utils::jemalloc::Stats();
6262
case Command::kEnable:
63-
if (!utils::jemalloc::IsProfilingEnbledViaEnv()) {
63+
if (!utils::jemalloc::IsProfilingEnabledViaEnv()) {
6464
request.SetResponseStatus(server::http::HttpStatus::kServiceUnavailable);
6565
return "'jemalloc' profiling is not available because the service was not started with a 'MALLOC_CONF' "
6666
"environment variable that contain 'prof:true'";

0 commit comments

Comments
 (0)