From 96db9c43a2dfc694612d8ceb7c548f8b1d92a4d5 Mon Sep 17 00:00:00 2001 From: Karim Shamazov Date: Thu, 8 Oct 2026 23:08:48 +0300 Subject: [PATCH 01/12] [k2] do not use pool allocator in kphp::log functions --- runtime-light/stdlib/diagnostics/logs.h | 26 ++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/runtime-light/stdlib/diagnostics/logs.h b/runtime-light/stdlib/diagnostics/logs.h index b332553be9..6bdb9b8340 100644 --- a/runtime-light/stdlib/diagnostics/logs.h +++ b/runtime-light/stdlib/diagnostics/logs.h @@ -37,29 +37,33 @@ void log(level level, std::optional> trace, std::format_s return std::nullopt; })}; - const size_t tagged_entries_size{ - static_cast((trace.has_value() ? 1 : 0) + opt_tags.transform([](contextual_tags& tags) noexcept { return tags.size(); }).value_or(0))}; - kphp::stl::vector tagged_entries{}; - tagged_entries.reserve(tagged_entries_size); + size_t tagged_entries_size{}; + static constexpr size_t TAGGED_ENTRIES_BUFFER_SIZE = 8UZ; + std::array tagged_entries_buffer; // NOLINT - opt_tags.transform([&tagged_entries](contextual_tags& tags) noexcept { + opt_tags.transform([&tagged_entries_buffer, &tagged_entries_size](contextual_tags& tags) noexcept { for (const auto& [key, value] : tags.values()) { - tagged_entries.push_back(k2::LogTaggedEntry{.key = key.data(), .value = value.data(), .key_len = key.size(), .value_len = value.size()}); + if (tagged_entries_size == TAGGED_ENTRIES_BUFFER_SIZE) { + break; + } + + tagged_entries_buffer[tagged_entries_size++] = + k2::LogTaggedEntry{.key = key.data(), .value = value.data(), .key_len = key.size(), .value_len = value.size()}; } return 0; }); - if (trace.has_value()) { + if (trace.has_value() && tagged_entries_size != TAGGED_ENTRIES_BUFFER_SIZE) { static constexpr std::string_view BACKTRACE_KEY = "trace"; static constexpr size_t BACKTRACE_BUFFER_SIZE = 1024UZ * 4UZ; std::array backtrace_buffer; // NOLINT size_t backtrace_size{impl::resolve_log_trace(backtrace_buffer, *trace)}; - tagged_entries.push_back( - k2::LogTaggedEntry{.key = BACKTRACE_KEY.data(), .value = backtrace_buffer.data(), .key_len = BACKTRACE_KEY.size(), .value_len = backtrace_size}); - k2::log(std::to_underlying(level), message, tagged_entries); + tagged_entries_buffer[tagged_entries_size++] = + k2::LogTaggedEntry{.key = BACKTRACE_KEY.data(), .value = backtrace_buffer.data(), .key_len = BACKTRACE_KEY.size(), .value_len = backtrace_size}; + k2::log(std::to_underlying(level), message, {tagged_entries_buffer.data(), tagged_entries_size}); return; } - k2::log(std::to_underlying(level), message, tagged_entries); + k2::log(std::to_underlying(level), message, {tagged_entries_buffer.data(), tagged_entries_size}); } } // namespace impl From b4ae1f479fca9ebd74897ac1c3560e53de0f1440 Mon Sep 17 00:00:00 2001 From: Karim Shamazov Date: Thu, 8 Oct 2026 23:09:47 +0300 Subject: [PATCH 02/12] [k2] log::error if out of memory --- runtime-light/allocator/pool-allocator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime-light/allocator/pool-allocator.cpp b/runtime-light/allocator/pool-allocator.cpp index c487c29799..66b954f0aa 100644 --- a/runtime-light/allocator/pool-allocator.cpp +++ b/runtime-light/allocator/pool-allocator.cpp @@ -104,7 +104,9 @@ auto pool_allocator::request_extra_memory(size_t requested_size) noexcept -> voi extra_mem_size = std::bit_ceil(extra_mem_size); auto* extra_mem{kphp::memory::platform::alloc(extra_mem_size)}; - kphp::log::assertion(extra_mem != nullptr); + if (extra_mem == nullptr) [[unlikely]] { + kphp::log::error("pool_allocator: failed to get extra memory from platform"); + } memory_resource.add_extra_memory(new (extra_mem) memory_resource::extra_memory_pool{extra_mem_size}); } From f84f579516ac9bc2cbaeff54e1614f85b2ceec24 Mon Sep 17 00:00:00 2001 From: Karim Shamazov Date: Mon, 12 Oct 2026 11:51:50 +0300 Subject: [PATCH 03/12] set `TAGGED_ENTRIES_BUFFER_SIZE` to 24 --- runtime-light/stdlib/diagnostics/logs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime-light/stdlib/diagnostics/logs.h b/runtime-light/stdlib/diagnostics/logs.h index 6bdb9b8340..0f7d79100e 100644 --- a/runtime-light/stdlib/diagnostics/logs.h +++ b/runtime-light/stdlib/diagnostics/logs.h @@ -38,7 +38,7 @@ void log(level level, std::optional> trace, std::format_s })}; size_t tagged_entries_size{}; - static constexpr size_t TAGGED_ENTRIES_BUFFER_SIZE = 8UZ; + static constexpr size_t TAGGED_ENTRIES_BUFFER_SIZE = 24UZ; std::array tagged_entries_buffer; // NOLINT opt_tags.transform([&tagged_entries_buffer, &tagged_entries_size](contextual_tags& tags) noexcept { From 92bebad40f9b501bce2d38ab570be291a6052466 Mon Sep 17 00:00:00 2001 From: Karim Shamazov Date: Tue, 13 Oct 2026 15:37:18 +0300 Subject: [PATCH 04/12] [k2] log memory usage statistics on out of memory Replace OOM assertions in pool_allocator::alloc/calloc/realloc_script_memory with raise_out_of_memory() that logs MemoryStats (current/peak usage, arena limit, total allocations, defragmentation calls, free pieces) before exiting, so OOM failures can be diagnosed from logs. --- .../core/allocator/pool-allocator.h | 1 + runtime-light/allocator/pool-allocator.cpp | 32 ++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/runtime-common/core/allocator/pool-allocator.h b/runtime-common/core/allocator/pool-allocator.h index fe85ebd2c1..07db2219ee 100644 --- a/runtime-common/core/allocator/pool-allocator.h +++ b/runtime-common/core/allocator/pool-allocator.h @@ -25,6 +25,7 @@ struct pool_allocator : private vk::not_copyable { size_t m_min_extra_mem_size{0}; auto request_extra_memory(size_t requested_size) noexcept -> void; + [[noreturn]] auto raise_out_of_memory(size_t requested_size) const noexcept -> void; public: pool_allocator(size_t script_mem_size, size_t min_extra_mem_size, size_t oom_handling_mem_size) noexcept; diff --git a/runtime-light/allocator/pool-allocator.cpp b/runtime-light/allocator/pool-allocator.cpp index 66b954f0aa..7ea935a6e2 100644 --- a/runtime-light/allocator/pool-allocator.cpp +++ b/runtime-light/allocator/pool-allocator.cpp @@ -50,7 +50,9 @@ auto pool_allocator::alloc_script_memory(size_t size) noexcept -> void* { request_extra_memory(size); mem = memory_resource.allocate(size); - kphp::log::assertion(mem != nullptr); + if (mem == nullptr) [[unlikely]] { + raise_out_of_memory(size); + } } return mem; @@ -64,7 +66,9 @@ auto pool_allocator::calloc_script_memory(size_t size) noexcept -> void* { request_extra_memory(size); mem = memory_resource.allocate0(size); - kphp::log::assertion(mem != nullptr); + if (mem == nullptr) [[unlikely]] { + raise_out_of_memory(size); + } } return mem; @@ -78,7 +82,9 @@ auto pool_allocator::realloc_script_memory(void* old_mem, size_t new_size, size_ request_extra_memory(new_size * 2); new_mem = memory_resource.reallocate(old_mem, new_size, old_size); - kphp::log::assertion(new_mem != nullptr); + if (new_mem == nullptr) [[unlikely]] { + raise_out_of_memory(new_size); + } } return new_mem; @@ -105,9 +111,27 @@ auto pool_allocator::request_extra_memory(size_t requested_size) noexcept -> voi auto* extra_mem{kphp::memory::platform::alloc(extra_mem_size)}; if (extra_mem == nullptr) [[unlikely]] { - kphp::log::error("pool_allocator: failed to get extra memory from platform"); + const auto& stats{memory_resource.get_memory_stats()}; + kphp::log::error("pool_allocator: failed to get extra memory from platform: requested {} bytes ({} with layout overhead), " + "memory usage: {} of {} bytes (max {}), real usage: {} bytes (max {}), " + "total allocations: {}, total memory allocated: {} bytes, " + "defragmentation calls: {}, huge memory pieces: {}, small memory pieces: {}", + requested_size, extra_mem_size, stats.memory_used, stats.memory_limit, stats.max_memory_used, stats.real_memory_used, + stats.max_real_memory_used, stats.total_allocations, stats.total_memory_allocated, stats.defragmentation_calls, + stats.huge_memory_pieces, stats.small_memory_pieces); } memory_resource.add_extra_memory(new (extra_mem) memory_resource::extra_memory_pool{extra_mem_size}); } +auto pool_allocator::raise_out_of_memory(size_t requested_size) const noexcept -> void { + const auto& stats{memory_resource.get_memory_stats()}; + kphp::log::error("pool_allocator: out of memory: failed to allocate {} bytes even after requesting extra memory, " + "memory usage: {} of {} bytes (max {}), real usage: {} bytes (max {}), " + "total allocations: {}, total memory allocated: {} bytes, " + "defragmentation calls: {}, huge memory pieces: {}, small memory pieces: {}", + requested_size, stats.memory_used, stats.memory_limit, stats.max_memory_used, stats.real_memory_used, + stats.max_real_memory_used, stats.total_allocations, stats.total_memory_allocated, stats.defragmentation_calls, + stats.huge_memory_pieces, stats.small_memory_pieces); +} + } // namespace kphp::memory From 5760f107fa8b0266e9235882bd3d5513c2603a05 Mon Sep 17 00:00:00 2001 From: Karim Shamazov Date: Tue, 13 Oct 2026 15:39:28 +0300 Subject: [PATCH 05/12] format --- runtime-light/allocator/pool-allocator.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/runtime-light/allocator/pool-allocator.cpp b/runtime-light/allocator/pool-allocator.cpp index 7ea935a6e2..b7c18a77d7 100644 --- a/runtime-light/allocator/pool-allocator.cpp +++ b/runtime-light/allocator/pool-allocator.cpp @@ -117,8 +117,8 @@ auto pool_allocator::request_extra_memory(size_t requested_size) noexcept -> voi "total allocations: {}, total memory allocated: {} bytes, " "defragmentation calls: {}, huge memory pieces: {}, small memory pieces: {}", requested_size, extra_mem_size, stats.memory_used, stats.memory_limit, stats.max_memory_used, stats.real_memory_used, - stats.max_real_memory_used, stats.total_allocations, stats.total_memory_allocated, stats.defragmentation_calls, - stats.huge_memory_pieces, stats.small_memory_pieces); + stats.max_real_memory_used, stats.total_allocations, stats.total_memory_allocated, stats.defragmentation_calls, stats.huge_memory_pieces, + stats.small_memory_pieces); } memory_resource.add_extra_memory(new (extra_mem) memory_resource::extra_memory_pool{extra_mem_size}); } @@ -129,9 +129,8 @@ auto pool_allocator::raise_out_of_memory(size_t requested_size) const noexcept - "memory usage: {} of {} bytes (max {}), real usage: {} bytes (max {}), " "total allocations: {}, total memory allocated: {} bytes, " "defragmentation calls: {}, huge memory pieces: {}, small memory pieces: {}", - requested_size, stats.memory_used, stats.memory_limit, stats.max_memory_used, stats.real_memory_used, - stats.max_real_memory_used, stats.total_allocations, stats.total_memory_allocated, stats.defragmentation_calls, - stats.huge_memory_pieces, stats.small_memory_pieces); + requested_size, stats.memory_used, stats.memory_limit, stats.max_memory_used, stats.real_memory_used, stats.max_real_memory_used, + stats.total_allocations, stats.total_memory_allocated, stats.defragmentation_calls, stats.huge_memory_pieces, stats.small_memory_pieces); } } // namespace kphp::memory From 0a830dbc48748d35aa211d0299004e05f927add6 Mon Sep 17 00:00:00 2001 From: Karim Shamazov Date: Wed, 14 Oct 2026 18:00:41 +0300 Subject: [PATCH 06/12] [k2] reserve a tagged entry slot for the trace When a trace is present, contextual tags are capped at TAGGED_ENTRIES_BUFFER_SIZE - 1 so the trace is never dropped. Co-Authored-By: Claude Code --- runtime-light/stdlib/diagnostics/logs.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/runtime-light/stdlib/diagnostics/logs.h b/runtime-light/stdlib/diagnostics/logs.h index 0f7d79100e..712233ad22 100644 --- a/runtime-light/stdlib/diagnostics/logs.h +++ b/runtime-light/stdlib/diagnostics/logs.h @@ -38,12 +38,15 @@ void log(level level, std::optional> trace, std::format_s })}; size_t tagged_entries_size{}; - static constexpr size_t TAGGED_ENTRIES_BUFFER_SIZE = 24UZ; + static constexpr size_t TAGGED_ENTRIES_BUFFER_SIZE{24UZ}; std::array tagged_entries_buffer; // NOLINT - opt_tags.transform([&tagged_entries_buffer, &tagged_entries_size](contextual_tags& tags) noexcept { + // Reserve one slot for the trace when it's present + const size_t tagged_entries_capacity{trace.has_value() ? TAGGED_ENTRIES_BUFFER_SIZE - 1 : TAGGED_ENTRIES_BUFFER_SIZE}; + + opt_tags.transform([&tagged_entries_buffer, &tagged_entries_size, tagged_entries_capacity](contextual_tags& tags) noexcept { for (const auto& [key, value] : tags.values()) { - if (tagged_entries_size == TAGGED_ENTRIES_BUFFER_SIZE) { + if (tagged_entries_size == tagged_entries_capacity) { break; } @@ -52,9 +55,9 @@ void log(level level, std::optional> trace, std::format_s } return 0; }); - if (trace.has_value() && tagged_entries_size != TAGGED_ENTRIES_BUFFER_SIZE) { + if (trace.has_value()) { static constexpr std::string_view BACKTRACE_KEY = "trace"; - static constexpr size_t BACKTRACE_BUFFER_SIZE = 1024UZ * 4UZ; + static constexpr size_t BACKTRACE_BUFFER_SIZE{1024UZ * 4UZ}; std::array backtrace_buffer; // NOLINT size_t backtrace_size{impl::resolve_log_trace(backtrace_buffer, *trace)}; tagged_entries_buffer[tagged_entries_size++] = From b8bdb1f7188e07b06d4cd54423b21260fff4048a Mon Sep 17 00:00:00 2001 From: Karim Shamazov Date: Wed, 14 Oct 2026 18:00:41 +0300 Subject: [PATCH 07/12] [k2] unify out of memory logging in pool_allocator raise_out_of_memory() now takes a context string and is reused for the platform allocation failure in request_extra_memory(), so memory usage statistics are logged in a single place. The message no longer mentions the extra-memory request, decoupling it from the allocation strategy. Co-Authored-By: Claude Code --- .../core/allocator/pool-allocator.h | 3 ++- runtime-light/allocator/pool-allocator.cpp | 24 +++++++------------ 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/runtime-common/core/allocator/pool-allocator.h b/runtime-common/core/allocator/pool-allocator.h index 07db2219ee..beaf9b0ecf 100644 --- a/runtime-common/core/allocator/pool-allocator.h +++ b/runtime-common/core/allocator/pool-allocator.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include "common/mixin/not_copyable.h" #include "runtime-common/core/memory-resource/unsynchronized_pool_resource.h" @@ -25,7 +26,7 @@ struct pool_allocator : private vk::not_copyable { size_t m_min_extra_mem_size{0}; auto request_extra_memory(size_t requested_size) noexcept -> void; - [[noreturn]] auto raise_out_of_memory(size_t requested_size) const noexcept -> void; + [[noreturn]] auto raise_out_of_memory(std::string_view context, size_t requested_size) const noexcept -> void; public: pool_allocator(size_t script_mem_size, size_t min_extra_mem_size, size_t oom_handling_mem_size) noexcept; diff --git a/runtime-light/allocator/pool-allocator.cpp b/runtime-light/allocator/pool-allocator.cpp index b7c18a77d7..187248e4a7 100644 --- a/runtime-light/allocator/pool-allocator.cpp +++ b/runtime-light/allocator/pool-allocator.cpp @@ -51,7 +51,7 @@ auto pool_allocator::alloc_script_memory(size_t size) noexcept -> void* { mem = memory_resource.allocate(size); if (mem == nullptr) [[unlikely]] { - raise_out_of_memory(size); + raise_out_of_memory("failed to allocate script memory", size); } } @@ -67,7 +67,7 @@ auto pool_allocator::calloc_script_memory(size_t size) noexcept -> void* { mem = memory_resource.allocate0(size); if (mem == nullptr) [[unlikely]] { - raise_out_of_memory(size); + raise_out_of_memory("failed to allocate script memory", size); } } @@ -83,7 +83,7 @@ auto pool_allocator::realloc_script_memory(void* old_mem, size_t new_size, size_ new_mem = memory_resource.reallocate(old_mem, new_size, old_size); if (new_mem == nullptr) [[unlikely]] { - raise_out_of_memory(new_size); + raise_out_of_memory("failed to reallocate script memory", new_size); } } @@ -111,26 +111,20 @@ auto pool_allocator::request_extra_memory(size_t requested_size) noexcept -> voi auto* extra_mem{kphp::memory::platform::alloc(extra_mem_size)}; if (extra_mem == nullptr) [[unlikely]] { - const auto& stats{memory_resource.get_memory_stats()}; - kphp::log::error("pool_allocator: failed to get extra memory from platform: requested {} bytes ({} with layout overhead), " - "memory usage: {} of {} bytes (max {}), real usage: {} bytes (max {}), " - "total allocations: {}, total memory allocated: {} bytes, " - "defragmentation calls: {}, huge memory pieces: {}, small memory pieces: {}", - requested_size, extra_mem_size, stats.memory_used, stats.memory_limit, stats.max_memory_used, stats.real_memory_used, - stats.max_real_memory_used, stats.total_allocations, stats.total_memory_allocated, stats.defragmentation_calls, stats.huge_memory_pieces, - stats.small_memory_pieces); + raise_out_of_memory("failed to get extra memory from platform", extra_mem_size); } memory_resource.add_extra_memory(new (extra_mem) memory_resource::extra_memory_pool{extra_mem_size}); } -auto pool_allocator::raise_out_of_memory(size_t requested_size) const noexcept -> void { +auto pool_allocator::raise_out_of_memory(std::string_view context, size_t requested_size) const noexcept -> void { const auto& stats{memory_resource.get_memory_stats()}; - kphp::log::error("pool_allocator: out of memory: failed to allocate {} bytes even after requesting extra memory, " + kphp::log::error("pool_allocator: out of memory: {} (requested {} bytes), " "memory usage: {} of {} bytes (max {}), real usage: {} bytes (max {}), " "total allocations: {}, total memory allocated: {} bytes, " "defragmentation calls: {}, huge memory pieces: {}, small memory pieces: {}", - requested_size, stats.memory_used, stats.memory_limit, stats.max_memory_used, stats.real_memory_used, stats.max_real_memory_used, - stats.total_allocations, stats.total_memory_allocated, stats.defragmentation_calls, stats.huge_memory_pieces, stats.small_memory_pieces); + context, requested_size, stats.memory_used, stats.memory_limit, stats.max_memory_used, stats.real_memory_used, + stats.max_real_memory_used, stats.total_allocations, stats.total_memory_allocated, stats.defragmentation_calls, + stats.huge_memory_pieces, stats.small_memory_pieces); } } // namespace kphp::memory From 1a2eb4ca1a1cafdc5d28442a971ea32a8aae0127 Mon Sep 17 00:00:00 2001 From: Karim Shamazov Date: Wed, 14 Oct 2026 18:07:17 +0300 Subject: [PATCH 08/12] format --- runtime-light/allocator/pool-allocator.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/runtime-light/allocator/pool-allocator.cpp b/runtime-light/allocator/pool-allocator.cpp index 187248e4a7..edcff83beb 100644 --- a/runtime-light/allocator/pool-allocator.cpp +++ b/runtime-light/allocator/pool-allocator.cpp @@ -122,9 +122,8 @@ auto pool_allocator::raise_out_of_memory(std::string_view context, size_t reques "memory usage: {} of {} bytes (max {}), real usage: {} bytes (max {}), " "total allocations: {}, total memory allocated: {} bytes, " "defragmentation calls: {}, huge memory pieces: {}, small memory pieces: {}", - context, requested_size, stats.memory_used, stats.memory_limit, stats.max_memory_used, stats.real_memory_used, - stats.max_real_memory_used, stats.total_allocations, stats.total_memory_allocated, stats.defragmentation_calls, - stats.huge_memory_pieces, stats.small_memory_pieces); + context, requested_size, stats.memory_used, stats.memory_limit, stats.max_memory_used, stats.real_memory_used, stats.max_real_memory_used, + stats.total_allocations, stats.total_memory_allocated, stats.defragmentation_calls, stats.huge_memory_pieces, stats.small_memory_pieces); } } // namespace kphp::memory From f86a2d51119c2f36a960137a8c2186f1cbf9f0c9 Mon Sep 17 00:00:00 2001 From: Karim Shamazov Date: Thu, 15 Oct 2026 12:39:58 +0300 Subject: [PATCH 09/12] do not pass context --- runtime-common/core/allocator/pool-allocator.h | 2 +- runtime-light/allocator/pool-allocator.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/runtime-common/core/allocator/pool-allocator.h b/runtime-common/core/allocator/pool-allocator.h index beaf9b0ecf..a3ae58c0d4 100644 --- a/runtime-common/core/allocator/pool-allocator.h +++ b/runtime-common/core/allocator/pool-allocator.h @@ -26,7 +26,7 @@ struct pool_allocator : private vk::not_copyable { size_t m_min_extra_mem_size{0}; auto request_extra_memory(size_t requested_size) noexcept -> void; - [[noreturn]] auto raise_out_of_memory(std::string_view context, size_t requested_size) const noexcept -> void; + [[noreturn]] auto raise_out_of_memory(size_t requested_size) const noexcept -> void; public: pool_allocator(size_t script_mem_size, size_t min_extra_mem_size, size_t oom_handling_mem_size) noexcept; diff --git a/runtime-light/allocator/pool-allocator.cpp b/runtime-light/allocator/pool-allocator.cpp index edcff83beb..da7bfe5f55 100644 --- a/runtime-light/allocator/pool-allocator.cpp +++ b/runtime-light/allocator/pool-allocator.cpp @@ -51,7 +51,7 @@ auto pool_allocator::alloc_script_memory(size_t size) noexcept -> void* { mem = memory_resource.allocate(size); if (mem == nullptr) [[unlikely]] { - raise_out_of_memory("failed to allocate script memory", size); + raise_out_of_memory(size); } } @@ -67,7 +67,7 @@ auto pool_allocator::calloc_script_memory(size_t size) noexcept -> void* { mem = memory_resource.allocate0(size); if (mem == nullptr) [[unlikely]] { - raise_out_of_memory("failed to allocate script memory", size); + raise_out_of_memory(size); } } @@ -83,7 +83,7 @@ auto pool_allocator::realloc_script_memory(void* old_mem, size_t new_size, size_ new_mem = memory_resource.reallocate(old_mem, new_size, old_size); if (new_mem == nullptr) [[unlikely]] { - raise_out_of_memory("failed to reallocate script memory", new_size); + raise_out_of_memory(new_size); } } @@ -111,18 +111,18 @@ auto pool_allocator::request_extra_memory(size_t requested_size) noexcept -> voi auto* extra_mem{kphp::memory::platform::alloc(extra_mem_size)}; if (extra_mem == nullptr) [[unlikely]] { - raise_out_of_memory("failed to get extra memory from platform", extra_mem_size); + raise_out_of_memory(extra_mem_size); } memory_resource.add_extra_memory(new (extra_mem) memory_resource::extra_memory_pool{extra_mem_size}); } -auto pool_allocator::raise_out_of_memory(std::string_view context, size_t requested_size) const noexcept -> void { +auto pool_allocator::raise_out_of_memory(size_t requested_size) const noexcept -> void { const auto& stats{memory_resource.get_memory_stats()}; - kphp::log::error("pool_allocator: out of memory: {} (requested {} bytes), " + kphp::log::error("pool_allocator: out of memory (requested {} bytes), " "memory usage: {} of {} bytes (max {}), real usage: {} bytes (max {}), " "total allocations: {}, total memory allocated: {} bytes, " "defragmentation calls: {}, huge memory pieces: {}, small memory pieces: {}", - context, requested_size, stats.memory_used, stats.memory_limit, stats.max_memory_used, stats.real_memory_used, stats.max_real_memory_used, + requested_size, stats.memory_used, stats.memory_limit, stats.max_memory_used, stats.real_memory_used, stats.max_real_memory_used, stats.total_allocations, stats.total_memory_allocated, stats.defragmentation_calls, stats.huge_memory_pieces, stats.small_memory_pieces); } From b54ef322649c40e12a59c55fc2882d3b1d476f25 Mon Sep 17 00:00:00 2001 From: Karim Shamazov Date: Thu, 15 Oct 2026 13:03:07 +0300 Subject: [PATCH 10/12] remove unused include --- runtime-common/core/allocator/pool-allocator.h | 1 - 1 file changed, 1 deletion(-) diff --git a/runtime-common/core/allocator/pool-allocator.h b/runtime-common/core/allocator/pool-allocator.h index a3ae58c0d4..07db2219ee 100644 --- a/runtime-common/core/allocator/pool-allocator.h +++ b/runtime-common/core/allocator/pool-allocator.h @@ -5,7 +5,6 @@ #pragma once #include -#include #include "common/mixin/not_copyable.h" #include "runtime-common/core/memory-resource/unsynchronized_pool_resource.h" From c24bdd8409c8c95bd5a1cf03b19f5b00e64b7999 Mon Sep 17 00:00:00 2001 From: Karim Shamazov Date: Thu, 15 Oct 2026 13:16:42 +0300 Subject: [PATCH 11/12] brace init --- runtime-light/stdlib/diagnostics/logs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime-light/stdlib/diagnostics/logs.h b/runtime-light/stdlib/diagnostics/logs.h index 712233ad22..18f3964323 100644 --- a/runtime-light/stdlib/diagnostics/logs.h +++ b/runtime-light/stdlib/diagnostics/logs.h @@ -56,7 +56,7 @@ void log(level level, std::optional> trace, std::format_s return 0; }); if (trace.has_value()) { - static constexpr std::string_view BACKTRACE_KEY = "trace"; + static constexpr std::string_view BACKTRACE_KEY{"trace"}; static constexpr size_t BACKTRACE_BUFFER_SIZE{1024UZ * 4UZ}; std::array backtrace_buffer; // NOLINT size_t backtrace_size{impl::resolve_log_trace(backtrace_buffer, *trace)}; From 7384cf28060903dac53dfa06da3d0e7a45980af7 Mon Sep 17 00:00:00 2001 From: Karim Shamazov Date: Thu, 15 Oct 2026 13:19:36 +0300 Subject: [PATCH 12/12] #include --- runtime-light/stdlib/diagnostics/logs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime-light/stdlib/diagnostics/logs.h b/runtime-light/stdlib/diagnostics/logs.h index 18f3964323..2f45138140 100644 --- a/runtime-light/stdlib/diagnostics/logs.h +++ b/runtime-light/stdlib/diagnostics/logs.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "runtime-light/k2-platform/k2-api.h" #include "runtime-light/stdlib/diagnostics/backtrace.h"