MLCE-133 Fix dangling calls to Manage()
authorPablo Tello <pablo.tello@arm.com>
Tue, 3 Dec 2019 15:46:50 +0000 (15:46 +0000)
committerDerek Lamberti <derek.lamberti@arm.com>
Fri, 6 Dec 2019 15:10:38 +0000 (15:10 +0000)
 * If nobody consumes an output tensor, the call to Manage()
   is not closed by a corresponding call to Allocate()

Change-Id: I6af9cff7aa1b7eb70bcf691c00c0ce07b48e7527
Signed-off-by: Pablo Tello <pablo.tello@arm.com>
src/armnn/Graph.cpp

index fe6a7c8..d44e43c 100644 (file)
@@ -199,6 +199,11 @@ Status Graph::AllocateDynamicBuffers()
                 {
                     handleReferenceCounts[tensorHandle] = numConnections;
                     tensorHandle->Manage();
+                    if (handleReferenceCounts[tensorHandle] == 0u)
+                    {
+                          // if nobody consumes this tensor we call Allocate()
+                          tensorHandle->Allocate();
+                    }
                 }
                 else
                 {