SWDEV-485763 - Fix memory leaks in various unit tests
Fix memory leaks by adding missing destroy calls for events, streams, and graphs at the end of tests. Ensure that every test case executes destroy calls, regardless of whether it passes or fails. Change-Id: I814e35c528d90ed2abb34d77377f1a7fd3f1f11c
这个提交包含在:
@@ -251,6 +251,9 @@ static void EventSync() {
|
||||
} else {
|
||||
IfTestPassed = true;
|
||||
}
|
||||
|
||||
HIP_CHECK(hipEventDestroy(start));
|
||||
HIP_CHECK(hipEventDestroy(end));
|
||||
}
|
||||
|
||||
/* Launch a kernel in hipStreamPerThread, while it is in flight check for
|
||||
@@ -475,6 +478,7 @@ TEST_CASE("Unit_hipStreamPerThread_StrmWaitEvt") {
|
||||
}
|
||||
HIP_CHECK(hipFree(Ad));
|
||||
HIP_CHECK(hipFree(Ad1));
|
||||
HIP_CHECK(hipEventDestroy(e1));
|
||||
HIP_CHECK(hipStreamDestroy(Strm));
|
||||
delete[] Ah;
|
||||
delete Ah1;
|
||||
|
||||
@@ -23,6 +23,7 @@ TEST_CASE("Unit_hipStreamPerThread_EventRecord") {
|
||||
hipEvent_t event;
|
||||
HIP_CHECK(hipEventCreate(&event));
|
||||
HIP_CHECK(hipEventRecord(event, hipStreamPerThread));
|
||||
HIP_CHECK(hipEventDestroy(event));
|
||||
}
|
||||
|
||||
__global__ void update_even_odd(unsigned int N, int* out) {
|
||||
@@ -61,4 +62,9 @@ TEST_CASE("Unit_hipStreamPerThread_EventSynchronize") {
|
||||
REQUIRE(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HIP_CHECK(hipHostFree(A_h));
|
||||
HIP_CHECK(hipFree(A_d));
|
||||
HIP_CHECK(hipEventDestroy(start));
|
||||
HIP_CHECK(hipEventDestroy(end));
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户