@Jose
Any moderately large program needs a considerable amount of memory to compile, especially if optimizing is enabled.
For instance, one of my ongoing projects when compiled with stormC4 in gcc mode can get through 40MB of memory during a full build.