On Linux systems considered containerized then os::available_memory will call into OSContainer::memory_limit_in_bytes and read the memory limit information from the /proc/self/mountinfo or similar.
This can take significant background resources, mostly since os::available_memory is called every iteration of each compiler thread's main loop to help determine if the system should add more compiler threads.
There are a couple of possible solutions:
- add a grace time to how often OSContainer::memory_limit_in_bytes actually reads the /proc configuration
- refactor compiler thread loop to make that possibly_add_compiler_threads a periodic task rather than something that each and every compiler thread does between every compilation