If the build hits the memory limit, CircleCI will save a file called
memory-usage.txt into the Artifacts tab for that build. This is described in more detail in this doc. However, the memory usage will only be logged in the builds that finish with out-of-memory errors.
If you would like to monitor memory usage in your build pro-actively, you could add something like this to your circle.yml file:
- FILE=$CIRCLE_ARTIFACTS/memory-usage-actual.txt; while true; do ps -u ubuntu eo pid,%cpu,%mem,args,uname --sort=-%mem >> $FILE; echo "----------" >> $FILE; sleep 1; done: # note the colon here background: true
This command will run in the background and will generate the memory usage stats every second till the build finishes, one per line.