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
[ROCm/hip-tests commit: 9cffda4ebb]
이 커밋은 다음에 포함됨:
1 부모
d9482cf69c
커밋
fe9860bd47
33 파일이 변경됨
+142
-38
검색과 일치하는 파일 없음
@@ -488,12 +488,16 @@ bool validateStreamPrioritiesWithEvents() {
|
||||
OP(low, high)
|
||||
#undef OP
|
||||
|
||||
// free host & device memory
|
||||
// free host & device memory & events
|
||||
#define OP(x) \
|
||||
free(src_h_##x); \
|
||||
free(dst_h_##x); \
|
||||
HIP_CHECK(hipFree(src_d_##x)); \
|
||||
HIP_CHECK(hipFree(dst_d_##x));
|
||||
HIP_CHECK(hipFree(dst_d_##x)); \
|
||||
if (enable_priority_##x) { \
|
||||
HIP_CHECK(hipEventDestroy(event_start_##x)); \
|
||||
HIP_CHECK(hipEventDestroy(event_end_##x)); \
|
||||
}
|
||||
OP(low)
|
||||
OP(normal)
|
||||
OP(high)
|
||||
@@ -801,6 +805,33 @@ void TestForMultipleStreamWithPriority(void) {
|
||||
REQUIRE(memcmp(dst_h_high[i], src_h_high[i], size) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < LOW_PRIORITY_STREAMCOUNT; i++) {
|
||||
if (enable_priority_low) {
|
||||
HIP_CHECK(hipEventDestroy(event_start_low[i]));
|
||||
HIP_CHECK(hipEventDestroy(event_end_low[i]));
|
||||
}
|
||||
|
||||
HIP_CHECK(hipStreamDestroy(stream_low[i]));
|
||||
}
|
||||
|
||||
for (int i = 0; i < NORMAL_PRIORITY_STREAMCOUNT; i++) {
|
||||
if (enable_priority_normal) {
|
||||
HIP_CHECK(hipEventDestroy(event_start_normal[i]));
|
||||
HIP_CHECK(hipEventDestroy(event_end_normal[i]));
|
||||
}
|
||||
|
||||
HIP_CHECK(hipStreamDestroy(stream_normal[i]));
|
||||
}
|
||||
|
||||
for (int i = 0; i < HIGH_PRIORITY_STREAMCOUNT; i++) {
|
||||
if (enable_priority_high) {
|
||||
HIP_CHECK(hipEventDestroy(event_start_high[i]));
|
||||
HIP_CHECK(hipEventDestroy(event_end_high[i]));
|
||||
}
|
||||
|
||||
HIP_CHECK(hipStreamDestroy(stream_high[i]));
|
||||
}
|
||||
}
|
||||
} // namespace hipStreamCreateWithPriorityTest
|
||||
|
||||
|
||||
새 이슈에서 참조
사용자 차단