@@ -116,7 +116,8 @@ template <typename DerivedAllocator> class BaseAllocator {
116116 : memoryAddrSpaceId(memoryAddrSpaceId) {
117117 // CRTP
118118 derivedAlloc = static_cast <DerivedAllocator *>(this );
119- std::string loggerName = fmt::format (" memory:" , derivedAlloc->getName ());
119+ std::string const loggerName =
120+ fmt::format (" memory:" , derivedAlloc->getName ());
120121 logger = Log::get (loggerName);
121122
122123 // Default deallocation callback
@@ -136,7 +137,6 @@ template <typename DerivedAllocator> class BaseAllocator {
136137 }
137138
138139 virtual std::unique_ptr<MemoryBlock, MemoryBlock::deallocator_fn>
139-
140140 allocateBlock (size_t size) = 0;
141141
142142 template <typename T> MemoryAccessor<T> allocate (size_t num) {
@@ -152,7 +152,7 @@ template <typename DerivedAllocator> class BaseAllocator {
152152 // Check if the allocated memory is really accessible by writing to the
153153 // allocated memory and reading back. Exponentially increase offset to
154154 // speed up testing.
155- MemoryAccessor<volatile uint8_t > byteAccessor (*mem);
155+ MemoryAccessor<volatile uint8_t > const byteAccessor (*mem);
156156 size_t idx = 0 ;
157157 for (int i = 0 ; idx < mem->getSize (); i++, idx = (1 << i)) {
158158 auto val = static_cast <uint8_t >(i);
@@ -166,6 +166,8 @@ template <typename DerivedAllocator> class BaseAllocator {
166166 return MemoryAccessor<T>(std::move (mem));
167167 }
168168
169+ virtual ~BaseAllocator () {}
170+
169171protected:
170172 void insertMemoryBlock (const MemoryBlock &mem) {
171173 auto &mm = MemoryManager::get ();
@@ -217,8 +219,8 @@ class LinearAllocator : public BaseAllocator<LinearAllocator> {
217219
218220 std::string getName () const ;
219221
220- virtual std::unique_ptr<MemoryBlock, MemoryBlock::deallocator_fn>
221- allocateBlock (size_t size);
222+ std::unique_ptr<MemoryBlock, MemoryBlock::deallocator_fn>
223+ allocateBlock (size_t size) override ;
222224
223225private:
224226 static constexpr size_t alignBytes = sizeof (uintptr_t );
@@ -247,7 +249,7 @@ class HostRam {
247249 std::string getName () const { return " HostRamAlloc" ; }
248250
249251 std::unique_ptr<MemoryBlock, MemoryBlock::deallocator_fn>
250- allocateBlock (size_t size);
252+ allocateBlock (size_t size) override ;
251253 };
252254
253255 static HostRamAllocator &getAllocator () {
@@ -264,7 +266,7 @@ class HostDmaRam {
264266 public:
265267 HostDmaRamAllocator (int num);
266268
267- virtual ~HostDmaRamAllocator ();
269+ ~HostDmaRamAllocator () override ;
268270
269271 std::string getName () const { return getUdmaBufName (num); }
270272
0 commit comments