onnxruntime/onnxruntime/test/framework/dummy_allocator.cc
Scott McKay 175983c082
Move memory info into IAllocator (#2850)
- Update IAllocator setup to move the OrtMemoryInfo to the base class instead of requiring derived classes to have that as a member and override a virtual method to return it.
  - Cleanup CreateAllocator setup to take an argument as to whether to wrap the device allocator in an arena allocator. The choice to do that isn't a property of the underlying device allocator.
  - Minor cleanups in the various EPs to adjust to the change to IAllocator and CreateAllocator, and to use the create_arena flag consistently when available.
2020-06-22 11:18:52 +10:00

22 lines
508 B
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "dummy_allocator.h"
#include "core/session/onnxruntime_cxx_api.h"
namespace onnxruntime {
namespace test {
DummyAllocator::DummyAllocator()
: IAllocator(OrtMemoryInfo(kDummyAllocator, OrtAllocatorType::OrtDeviceAllocator)) {
}
void* DummyAllocator::Alloc(size_t size) {
return malloc(size);
}
void DummyAllocator::Free(void* p) {
free(p);
}
} // namespace test
} // namespace onnxruntime