Skip to content

Commit

Permalink
Merge pull request #18792 from cjjdespres/fix-romclasscache-shutdown
Browse files Browse the repository at this point in the history
Ensure ROM class cache shutdown is necessary
  • Loading branch information
mpirvu authored Jan 24, 2024
2 parents 381942b + 27b0507 commit 8e696cc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions runtime/compiler/runtime/JITClientSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,8 @@ ClientSessionHT::purgeOldDataIfNeeded()
oldAge = OLD_AGE_UNDER_LOW_MEMORY; //memory is low
}
}

bool hadExistingClients = !_clientSessionMap.empty();
// Time for a purge operation.
// Scan the entire table and delete old elements that are not in use
for (auto iter = _clientSessionMap.begin(); iter != _clientSessionMap.end(); ++iter)
Expand All @@ -1241,8 +1243,8 @@ ClientSessionHT::purgeOldDataIfNeeded()
_clientSessionMap.erase(iter); // delete the mapping from the hashtable
}
}
// If all the clients were deleted, shut down the shared ROMClass cache
if (_clientSessionMap.empty())
// If the purge operation was responsible for deleting the last client sessions, shut down the shared ROM class cache as well
if (hadExistingClients && _clientSessionMap.empty())
{
if (auto cache = TR::CompilationInfo::get()->getJITServerSharedROMClassCache())
cache->shutdown();
Expand Down

0 comments on commit 8e696cc

Please sign in to comment.