8 #ifndef BLACKCAT_TENSORS_ALLOCATORS_LOGGING_ALLOCATOR_H_ 9 #define BLACKCAT_TENSORS_ALLOCATORS_LOGGING_ALLOCATOR_H_ 14 namespace allocators {
23 template<
class Allocator>
37 std::shared_ptr<detail::log_info> info =
51 info->current_allocated += size *
sizeof(
value_type);
52 if (info->current_allocated > info->max_allocated){
53 info->max_allocated = info->current_allocated;
55 return parent_type::allocate(size);
61 "BC_DEALLOCATION ERROR, DOUBLE DUPLICATION");
62 info->current_allocated -= size *
sizeof(
value_type);
64 parent_type::deallocate(ptr, size);
pointer allocate(int size)
Definition: logging_allocator.h:49
Definition: logging_allocator.h:31
unsigned current_allocated
Definition: logging_allocator.h:19
typename traits::pointer pointer
Definition: allocator_forwarder.h:27
BCHOT self_type & operator=(const Expression_Base< Xpr > ¶m)
Definition: tensor_operations.h:19
int size_t
Definition: common.h:283
unsigned max_allocated
Definition: logging_allocator.h:18
Logging_Allocator(const Logging_Allocator< U > &other)
Definition: logging_allocator.h:41
Definition: logging_allocator.h:17
typename traits::value_type value_type
Definition: allocator_forwarder.h:25
void deallocate(pointer ptr, bc::size_t size)
Definition: logging_allocator.h:58
Definition: allocator_forwarder.h:22
#define BC_ASSERT(condition, message)
Definition: common.h:185
Definition: logging_allocator.h:24
The Evaluator determines if an expression needs to be greedily optimized.
Definition: algorithms.h:22