diff options
author | udovichenko-r <udovichenko-r@yandex-team.ru> | 2022-06-22 17:31:06 +0300 |
---|---|---|
committer | udovichenko-r <udovichenko-r@yandex-team.ru> | 2022-06-22 17:31:06 +0300 |
commit | fe06d3c7d1c04f99c1a239707c2a377cd95e20a4 (patch) | |
tree | 8ef3daf80d504ba8e25188305e038f4e1a053673 | |
parent | 03ae68528a1fca061195bac52f0484f6f54b2582 (diff) | |
download | ydb-fe06d3c7d1c04f99c1a239707c2a377cd95e20a4.tar.gz |
KIKIMR-15109 Drop unused
ref:10621acf302b8f49cdf864383910973a2ef36ac1
-rw-r--r-- | ydb/core/util/make_holder_with_record.h | 10 | ||||
-rw-r--r-- | ydb/core/util/tracking_alloc.h | 101 |
2 files changed, 0 insertions, 111 deletions
diff --git a/ydb/core/util/make_holder_with_record.h b/ydb/core/util/make_holder_with_record.h deleted file mode 100644 index 82da0e8104..0000000000 --- a/ydb/core/util/make_holder_with_record.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once -#include <util/generic/ptr.h> - -/// Similar to MakeHolder, but also fills Record field of T with first argument. Useful for events. -template <class T> -[[nodiscard]] THolder<T> MakeHolderWithRecord(auto&& record, auto&& ... args) { - THolder<T> holder = MakeHolder<T>(std::forward<decltype(args)>(args)...); - holder->Record = std::forward<decltype(record)>(record); - return holder; -} diff --git a/ydb/core/util/tracking_alloc.h b/ydb/core/util/tracking_alloc.h deleted file mode 100644 index 96855506ac..0000000000 --- a/ydb/core/util/tracking_alloc.h +++ /dev/null @@ -1,101 +0,0 @@ -#pragma once - -#include <util/system/yassert.h> -#include <util/generic/ptr.h> - -#include <memory> - -namespace NKikimr { - -template <typename T> -class TTrackingAllocator : public std::allocator<T> { -public: - typedef size_t size_type; - typedef T* pointer; - typedef const T* const_pointer; - - template<typename U> - struct rebind { - typedef TTrackingAllocator<U> other; - }; - - struct propagate_on_container_copy_assignment : public std::true_type {}; - struct propagate_on_container_move_assignment : public std::true_type {}; - struct propagate_on_container_swap : public std::true_type {}; - - template<typename U> friend class TTrackingAllocator; - - TTrackingAllocator() noexcept - : std::allocator<T>() - , Allocated(new size_t(0)) - { - } - - TTrackingAllocator(const TSimpleSharedPtr<size_t>& allocated) noexcept - : std::allocator<T>() - , Allocated(allocated) - { - } - - TTrackingAllocator(const TTrackingAllocator& a) noexcept - : std::allocator<T>(a) - , Allocated(a.Allocated) - { - } - - TTrackingAllocator(TTrackingAllocator&& a) noexcept - : std::allocator<T>(std::move(static_cast<std::allocator<T>&&>(a))) - , Allocated(a.Allocated) - { - a.Allocated = nullptr; - } - - template <class U> - TTrackingAllocator(const TTrackingAllocator<U>& a) noexcept - : std::allocator<T>(a) - , Allocated(a.Allocated) - { - } - - TTrackingAllocator& operator=(const TTrackingAllocator& a) noexcept - { - Allocated = a.Allocated; - std::allocator<T>::operator=(a); - return *this; - } - - TTrackingAllocator& operator=(TTrackingAllocator&& a) noexcept - { - Allocated = a.Allocated; - a.Allocated = nullptr; - std::allocator<T>::operator=(std::move(static_cast<std::allocator<T>&&>(a))); - return *this; - } - - ~TTrackingAllocator() { - } - - pointer allocate(size_type n, const void* hint = nullptr) { - *Allocated += n * sizeof(T); - return std::allocator<T>::allocate(n, hint); - } - - void deallocate(pointer p, size_type n) { - Y_ASSERT(*Allocated >= n * sizeof(T)); - *Allocated -= n * sizeof(T); - std::allocator<T>::deallocate(p, n); - } - - size_t GetAllocated() const { - return *Allocated; - } - - TSimpleSharedPtr<size_t> GetAllocatedPtr() const { - return Allocated; - } - -private: - TSimpleSharedPtr<size_t> Allocated; -}; - -} // NKikimr |