The RAM consumption doesn't have anything to do with the size of the compiled app.
We might be able to help with some more information:
When you get the out of memory error, check Task Manager to see the memory usage state:
1. Press CTRL+SHIFT+ESC
2. In the performance tab, tell us how much memory you have "Available"
3. In the Processes tab, click the word 'memory' at the top of its column to sort apps based on memory usage. What do you have at the top rows? What is using so much RAM?