diff options
author | Alexander Smirnov <alex@ydb.tech> | 2025-02-06 00:51:36 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2025-02-06 00:51:36 +0000 |
commit | 56094433309e9ee14b6be144db40dd8c200df4c6 (patch) | |
tree | e331c04c654370c8d6d5578b8c81a7828c254eaf /library/cpp/yt/memory/blob.cpp | |
parent | 95fac681074068aad4d6bc5a02b1d7a153de5a09 (diff) | |
parent | 37bab6825374df518e0b1cb748ce7bd2cef55688 (diff) | |
download | ydb-56094433309e9ee14b6be144db40dd8c200df4c6.tar.gz |
Merge branch 'rightlib' into merge-libs-250206-0050
Diffstat (limited to 'library/cpp/yt/memory/blob.cpp')
-rw-r--r-- | library/cpp/yt/memory/blob.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/library/cpp/yt/memory/blob.cpp b/library/cpp/yt/memory/blob.cpp index b4de038948c..2517446ec7e 100644 --- a/library/cpp/yt/memory/blob.cpp +++ b/library/cpp/yt/memory/blob.cpp @@ -4,6 +4,8 @@ #include <library/cpp/yt/malloc/malloc.h> +#include <library/cpp/yt/system/exit.h> + namespace NYT { //////////////////////////////////////////////////////////////////////////////// @@ -147,9 +149,17 @@ void TBlob::Reset() char* TBlob::DoAllocate(size_t size) { - return static_cast<char*>(PageAligned_ + auto* allocated = static_cast<char*>(PageAligned_ ? ::aligned_malloc(size, GetPageSize()) : ::malloc(size)); + + if (Y_UNLIKELY(!allocated)) { + AbortProcessDramatically( + EProcessExitCode::OutOfMemory, + "Out-of-memory during TBlob allocation"); + } + + return allocated; } void TBlob::Allocate(size_t newCapacity) |