已合并
【fix】: InternalAllocator::Free实现从.h文件移到.cc文件 #4014
luanchaowei创建于 7月15日
【fix】: InternalAllocator::Free实现从.h文件移到.cc文件 #4014
已合并
共 2 个文件变更+6-4
| @@ -32,6 +32,11 @@ InternalAllocator::~InternalAllocator() { | |||
| 32 | gert::DeviceMemoryRecorder::ClearReserveMemory(); | 32 | gert::DeviceMemoryRecorder::ClearReserveMemory(); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | +void InternalAllocator::Free(MemBlock *block) { | ||
| 36 | + const auto rt_ret = aclrtFree(block->GetAddr()); | ||
| 37 | + GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, GELOGE(RT_FAILED, "[Free][Rt] failed.")); | ||
| 38 | +}; | ||
| 39 | + | ||
| 35 | MemBlock *InternalAllocator::Malloc(size_t size) { | 40 | MemBlock *InternalAllocator::Malloc(size_t size) { |
| 36 | if (size == 0U) { | 41 | if (size == 0U) { |
| 37 | GELOGD("Mem size == 0"); | 42 | GELOGD("Mem size == 0"); |
| @@ -35,10 +35,7 @@ constexpr int64_t kOverflowSize = 512; | |||
| 35 | class InternalAllocator : public Allocator { | 35 | class InternalAllocator : public Allocator { |
| 36 | public: | 36 | public: |
| 37 | MemBlock *Malloc(size_t size) override; | 37 | MemBlock *Malloc(size_t size) override; |
| 38 | - void Free(MemBlock *block) override { | 38 | + void Free(MemBlock *block) override; |
| 39 | - const auto rt_ret = aclrtFree(block->GetAddr()); | ||
| 40 | - GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, GELOGE(RT_FAILED, "[Free][Rt] failed.")); | ||
| 41 | - }; | ||
| 42 | ~InternalAllocator() override; | 39 | ~InternalAllocator() override; |
| 43 | 40 | ||
| 44 | private: | 41 | private: |