Program Listing for File MonotonicAllocationStrategy.hpp¶
↰ Return to documentation for file (umpire/strategy/MonotonicAllocationStrategy.hpp
)
//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2018, Lawrence Livermore National Security, LLC.
// Produced at the Lawrence Livermore National Laboratory
//
// Created by David Beckingsale, david@llnl.gov
// LLNL-CODE-747640
//
// All rights reserved.
//
// This file is part of Umpire.
//
// For details, see https://github.com/LLNL/Umpire
// Please also see the LICENSE file for MIT license.
//////////////////////////////////////////////////////////////////////////////
#ifndef UMPIRE_MonotonicAllocationStrategy_HPP
#define UMPIRE_MonotonicAllocationStrategy_HPP
#include <vector>
#include "umpire/strategy/AllocationStrategy.hpp"
#include "umpire/Allocator.hpp"
namespace umpire {
namespace strategy {
class MonotonicAllocationStrategy :
public AllocationStrategy
{
public:
MonotonicAllocationStrategy(
const std::string& name,
int id,
size_t capacity,
Allocator allocator);
void* allocate(size_t bytes);
void deallocate(void* ptr);
size_t getSize(void* ptr);
long getCurrentSize();
long getHighWatermark();
Platform getPlatform();
private:
void* m_block;
size_t m_size;
size_t m_capacity;
std::shared_ptr<AllocationStrategy> m_allocator;
};
} // end of namespace strategy
} // end of namespace umpire
#endif // UMPIRE_MonotonicAllocationStrategy_HPP