aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/containers/compact_vector/compact_vector.h
diff options
context:
space:
mode:
authortobo <tobo@yandex-team.com>2022-11-19 05:03:21 +0300
committertobo <tobo@yandex-team.com>2022-11-19 05:03:21 +0300
commit6edbb30167356f4dbbe13a0c27bfdd0c007fbba7 (patch)
treead56fb9bc4d0da408d9f563a49c96cf9c99a4268 /library/cpp/containers/compact_vector/compact_vector.h
parent024dc480aedd4a427ee9e6aab87df7dc56ffd67b (diff)
downloadydb-6edbb30167356f4dbbe13a0c27bfdd0c007fbba7.tar.gz
use y_allocate / y_deallocate
Diffstat (limited to 'library/cpp/containers/compact_vector/compact_vector.h')
-rw-r--r--library/cpp/containers/compact_vector/compact_vector.h13
1 files changed, 3 insertions, 10 deletions
diff --git a/library/cpp/containers/compact_vector/compact_vector.h b/library/cpp/containers/compact_vector/compact_vector.h
index b31a8b8464..ff1e94e024 100644
--- a/library/cpp/containers/compact_vector/compact_vector.h
+++ b/library/cpp/containers/compact_vector/compact_vector.h
@@ -1,12 +1,7 @@
#pragma once
#include <util/generic/yexception.h>
-#include <util/generic/utility.h>
-#include <util/memory/alloc.h>
-#include <util/stream/output.h>
-#include <util/system/yassert.h>
-
-#include <cstdlib>
+#include <util/system/sys_alloc.h>
// vector that is 8 bytes when empty (TVector is 24 bytes)
@@ -95,7 +90,7 @@ public:
}
}
if (Ptr)
- free(Header());
+ y_deallocate(Header());
}
TThis& operator = (TThis&& that) noexcept {
@@ -175,9 +170,7 @@ public:
const size_t realNewCapacity = (memSizePowOf2 - sizeof(THeader)) / sizeof(T);
Y_ASSERT(realNewCapacity >= newCapacity);
- void* mem = ::malloc(memSizePowOf2);
- if (mem == nullptr)
- ythrow yexception() << "out of memory";
+ void* mem = ::y_allocate(memSizePowOf2);
Ptr = (T*)(((THeader*)mem) + 1);
Header()->Size = 0;
Header()->Capacity = realNewCapacity;