Skip to content

Commit

Permalink
Free ramToRom memory directly
Browse files Browse the repository at this point in the history
Free ramToRom memory directly instead of through cached
 variable to ensure null check correct.

Signed-off-by: Theresa Mammarella <[email protected]>
  • Loading branch information
theresa-m committed Sep 19, 2024
1 parent 02cb848 commit 8e3cfc3
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions runtime/shared_common/shrinit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4283,8 +4283,6 @@ j9shr_shutdown(J9JavaVM *vm)
J9SharedStringFarm* jclStringFarm = config->jclStringFarm;
J9HashTable* urlHashTable = config->jclURLHashTable;
J9HashTable* utfHashTable = config->jclUTF8HashTable;
J9HashTable *romToRamHashTable = config->romToRamHashTable;
omrthread_rwmutex_t romToRamHashTableMutex = config->romToRamHashTableMutex;
J9VMThread* currentThread = vm->internalVMFunctions->currentVMThread(vm);

/* Free all of the cached ClasspathItems */
Expand Down Expand Up @@ -4329,15 +4327,13 @@ j9shr_shutdown(J9JavaVM *vm)
if (utfHashTable) {
hashTableFree(utfHashTable);
}
if (NULL != romToRamHashTable) {
omrthread_rwmutex_enter_write(romToRamHashTableMutex);
if (NULL != config->romToRamHashTable) {
omrthread_rwmutex_enter_write(config->romToRamHashTableMutex);
hashTableFree(config->romToRamHashTable);
config->romToRamHashTable = NULL;
omrthread_rwmutex_exit_write(config->romToRamHashTableMutex);
omrthread_rwmutex_destroy(config->romToRamHashTableMutex);
config->romToRamHashTableMutex = NULL;
if (romToRamHashTable) {
hashTableFree(romToRamHashTable);
}
omrthread_rwmutex_exit_write(romToRamHashTableMutex);
omrthread_rwmutex_destroy(romToRamHashTableMutex);
}

/* Kill the string farm */
Expand Down

0 comments on commit 8e3cfc3

Please sign in to comment.