Skip to content

Commit f0063ba

Browse files
committed
SWDEV-485827 release hostcall listener memory regardless of thread status
The early return if the thread is not alive causes memory leaks. Neither doorbell_ or urilocator are released if the thread is not alive. This change alters the logic so regardless of the thread status the HostcallListener releases its memory. Change-Id: Ie912360ec0e2ee257de9937b1a8d7375e6aebd83
1 parent 4e2fd19 commit f0063ba

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

rocclr/device/devhostcall.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -334,15 +334,14 @@ void HostcallListener::consumePackets() {
334334
}
335335

336336
void HostcallListener::terminate() {
337-
if (thread_.state() < Thread::FINISHED && !amd::Os::isThreadAlive(thread_)) {
338-
return;
339-
}
340-
kHostThreadActive.state = Init::State::kExit;
341-
doorbell_->Reset(SIGNAL_DONE);
337+
if (thread_.state() >= Thread::FINISHED || amd::Os::isThreadAlive(thread_)) {
338+
kHostThreadActive.state = Init::State::kExit;
339+
doorbell_->Reset(SIGNAL_DONE);
342340

343-
// FIXME_lmoriche: fix termination handshake
344-
while (thread_.state() < Thread::FINISHED) {
345-
amd::Os::yield();
341+
// FIXME_lmoriche: fix termination handshake
342+
while (thread_.state() < Thread::FINISHED) {
343+
amd::Os::yield();
344+
}
346345
}
347346

348347
#if defined(__clang__)

0 commit comments

Comments
 (0)