Skip to content

Commit

Permalink
Fix code cache cleanup in JitBuilder and TestCompiler on z/OS
Browse files Browse the repository at this point in the history
The allocated code cache memory was not being freed up on z/OS causing
memory leaks and eventual failure of tests which would not be able to
allocate code cache memory.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
  • Loading branch information
fjeremic committed Jan 17, 2020
1 parent 5de40f9 commit 4a3841c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fvtest/compilertest/runtime/TestCodeCacheManager.cpp
Expand Up @@ -92,6 +92,8 @@ TestCompiler::CodeCacheManager::freeCodeCacheSegment(TR::CodeCacheMemorySegment
{
#if defined(OMR_OS_WINDOWS)
VirtualFree(memSegment->_base, 0, MEM_RELEASE); // second arg must be zero when calling with MEM_RELEASE
#elif defined(J9ZOS390)
free(memSegment->_base);
#else
munmap(memSegment->_base, memSegment->_top - memSegment->_base + sizeof(TR::CodeCacheMemorySegment));
#endif
Expand Down
2 changes: 2 additions & 0 deletions jitbuilder/runtime/JBCodeCacheManager.cpp
Expand Up @@ -117,6 +117,8 @@ JitBuilder::CodeCacheManager::freeCodeCacheSegment(TR::CodeCacheMemorySegment *
{
#if defined(OMR_OS_WINDOWS)
VirtualFree(memSegment->_base, 0, MEM_RELEASE); // second arg must be zero when calling with MEM_RELEASE
#elif defined(J9ZOS390)
free(memSegment->_base);
#else
munmap(memSegment->_base, memSegment->_top - memSegment->_base + sizeof(TR::CodeCacheMemorySegment));
#endif
Expand Down

0 comments on commit 4a3841c

Please sign in to comment.