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
Этот коммит содержится в:
Marko Arandjelovic committed 2024-12-10 10:25:08 -05:00
1 родитель 7bb49582db
Коммит 9cffda4ebb
33 files changed
+142 -38

No files matched your search

+3
Просмотреть файл
@@ -138,6 +138,9 @@ TEST_CASE("Unit_hipMallocManaged_Advanced") {
}
HIP_CHECK(hipFree(A));
HIP_CHECK(hipFree(B));
HIP_CHECK(hipFree(C));
HIP_CHECK(hipEventDestroy(event0));
HIP_CHECK(hipEventDestroy(event1));
REQUIRE(maxError != 0.0f);
}
+9
Просмотреть файл
@@ -119,6 +119,9 @@ static void LaunchKrnl2(int* Hmm, size_t NumElms, int InitVal, int HmmMem) {
INFO("Data Mismatch observed at line: " << __LINE__);
REQUIRE(false);
}
HIP_CHECK(hipFree(ptr));
HIP_CHECK(hipStreamDestroy(strm));
}
static void LaunchKrnl3(int* Dptr, size_t NumElms, int InitVal) {
@@ -143,6 +146,9 @@ static void LaunchKrnl3(int* Dptr, size_t NumElms, int InitVal) {
INFO("Data Mismatch observed at line: " << __LINE__);
REQUIRE(false);
}
HIP_CHECK(hipFree(Hmm));
HIP_CHECK(hipStreamDestroy(strm));
}
@@ -180,6 +186,9 @@ static void LaunchKrnl5(int* Hmm1, size_t NumElms, int InitVal, int KerneltoLaun
INFO("Data Mismatch observed at line: " << __LINE__);
REQUIRE(false);
}
HIP_CHECK(hipFree(Hmm2));
HIP_CHECK(hipStreamDestroy(strm));
}
+1
Просмотреть файл
@@ -156,6 +156,7 @@ TEST_CASE("Unit_hipMemRangeGetAttributes_TstFlgs") {
}
HIP_CHECK(hipFree(Hmm));
HIP_CHECK(hipStreamDestroy(strm));
delete[] AcsdBy;
for (int i = 0; i < 4; ++i) {
delete Outpt[i];
+1
Просмотреть файл
@@ -418,6 +418,7 @@ TEST_CASE("Unit_hipMemcpy2DAsync_SizeCheck") {
// DeAllocating the memory
HIP_CHECK(hipFree(A_d));
HIP_CHECK(hipStreamDestroy(stream));
free(A_h);
}
+3
Просмотреть файл
@@ -278,4 +278,7 @@ TEST_CASE("Unit_hipMemset_2AsyncOperations") {
REQUIRE(v[0] == 0);
REQUIRE(v[1024] == 1.75f);
HIP_CHECK(hipFree(p2));
HIP_CHECK(hipStreamDestroy(s));
}