File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -151,9 +151,7 @@ ResultCode ANeuralNetworksExecution_setOutput(
151151 BACKEND_CALL_RET (ret, imgdnnBindingAddOutput, execution->imgdnn_binding_ ,
152152 execution->imgdnn_outputs_ [uindex], img_memory);
153153 IMGDNN_RETURN_ERR_IF_ERROR (ret);
154- // Store the memory objects to free them after the execution
155- execution->imgdnn_memories_ .push_back (img_memory);
156- // Store the memory objects to be able to lock them later
154+ // Store the memory objects to be able to lock and free them later
157155 execution->host_output_memories .emplace_back (data, img_memory);
158156 }
159157 return ANEURALNETWORKS_NO_ERROR;
@@ -405,6 +403,10 @@ ResultCode ANeuralNetworksExecution_notifyWait(
405403 ANEURALNETWORKS_BAD_DATA);
406404 BACKEND_CALL_RET (ret, imgdnnMemoryUnlock, hom.img_mem );
407405 IMGDNN_RETURN_ERR_IF_ERROR (ret);
406+
407+ // Destroy output memory now it's been read
408+ BACKEND_CALL_RET (ret, imgdnnMemoryDestroy, hom.img_mem );
409+ IMGDNN_RETURN_ERR_IF_ERROR (ret);
408410 }
409411 execution->host_output_memories .clear ();
410412 return ANEURALNETWORKS_NO_ERROR;
You can’t perform that action at this time.
0 commit comments