Description
Motivation and Background
The Mono AOT compiler currently requires a minimum of 16GB of RAM memory to compile System.Private.CoreLib.dll
using a linux machine. Currently, this limitation is preventing us from running fullAOT tests in our CI. The purpose of this issue is to explore ways to reduce the RAM consumption of the AOT compiler.
Analysis
We conducted a simple experiment within free -m
command inside a docker container using cbl-mariner-2.0-cross-amd64
on a machine with 32GB of RAM memory. The graph below presents the RAM memory consumption during consecutive AOT compilation for runningmono.dll
and System.Private.CoreLib.dll
assemblies using LLVM configuration in release mode.
The graph indicates a clear pattern of memory consumption during the AOT compilation of these two assemblies. The memory consumption for compiling runningmono.dll
is smaller as it is less complex, but the pattern is the same. However, there are two noticeable spikes that are worth investigating.
runningmono.dll
:
JIT time: 6518 ms
Generation time: 47876 ms
Assembly+Link time: 127 ms
System.Private.CoreLib.dll
:
JIT time: 53617 ms
Generation time: 388484 ms
Assembly+Link time: 2845 ms
The first spike, which is likely related to the JIT phase, does not have a constant steepness. This irregularity may indicate a potential issue with memory handling during this phase. The second spike likely corresponds to the generation phase, and it appears to be consistent. By addressing these spikes, we aim to reduce the RAM usage of the AOT compiler and improve its efficiency.
Tasks
- Correlate spikes with the code to identify any memory-related problems
- Use valgrind to search for any potential memory leaks
/cc: @vargaz @lambdageek @BrzVlad @ivanpovazan @fanyang-mono @matouskozak @SamMonoRT @steveisok