ArmNN
 21.08
RefRuntimeTests.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include <test/RuntimeTests.hpp>
7 
8 #include <LeakChecking.hpp>
9 
11 
12 #include <doctest/doctest.h>
13 
14 
15 #ifdef ARMNN_LEAK_CHECKING_ENABLED
16 TEST_SUITE("RefRuntime")
17 {
18 TEST_CASE("RuntimeMemoryLeaksCpuRef")
19 {
21 
23  armnn::RuntimeImpl runtime(options);
25 
26  std::vector<armnn::BackendId> backends = {armnn::Compute::CpuRef};
27  {
28  // Do a warmup of this so we make sure that all one-time
29  // initialization happens before we do the leak checking.
30  CreateAndDropDummyNetwork(backends, runtime);
31  }
32 
33  {
34  ARMNN_SCOPED_LEAK_CHECKER("LoadAndUnloadNetworkCpuRef");
35  CHECK(ARMNN_NO_LEAKS_IN_SCOPE());
36  // In the second run we check for all remaining memory
37  // in use after the network was unloaded. If there is any
38  // then it will be treated as a memory leak.
39  CreateAndDropDummyNetwork(backends, runtime);
40  CHECK(ARMNN_NO_LEAKS_IN_SCOPE());
41  CHECK(ARMNN_BYTES_LEAKED_IN_SCOPE() == 0);
42  CHECK(ARMNN_OBJECTS_LEAKED_IN_SCOPE() == 0);
43  }
44 }
45 }
46 #endif
47 
TEST_SUITE("TestConstTensorLayerVisitor")
#define ARMNN_SCOPED_LEAK_CHECKER(TAG)
CPU Execution: Reference C++ kernels.
#define ARMNN_LEAK_CHECKER_IS_ACTIVE()
#define ARMNN_OBJECTS_LEAKED_IN_SCOPE()
void RuntimeLoadedNetworksReserve(armnn::RuntimeImpl *runtime)
#define ARMNN_NO_LEAKS_IN_SCOPE()
#define ARMNN_BYTES_LEAKED_IN_SCOPE()