title: Getting Gradle error "Could not reserve enough space for object heap" constantly in Intellij IDEA
body: <p>So I have a problem with memory allocation. Sometimes it works, and sometimes it doesn't. I've read <a href="https://stackoverflow.com/questions/4401396/could-not-reserve-enough-space-for-object-heap">this thread</a> and tried the advice there multiple times. Sometimes <code>-Xms512m -Xmx768m</code> works, sometimes <code>-Xms256m -Xmx512m</code>. I'm sick and tired of having to tweak this setting in IntelliJ under the <code>Build, Execution, Deployment &gt; Build Tools &gt; Gradle &gt; Gradle VM</code> options setting. Is there no setting that solves this once and for all?</p>
  
  <p>I have 16GB of RAM on my Windows 7 computer, I'm running IntelliJ IDEA EAP 14 build 138.2210.3, 64 bit version. Android Gradle build plugin v0.12. </p>
  
  <p>I'm suspecting gradle is not running in 64 bit mode, or else it would have ~7 GB of free memory to eat from. Why is it not utilizing this?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I got the same error in <strong>Visual Studio 2015</strong> with <strong>cordova 5.1.1</strong> under <strong>Windows 10</strong>. 
  See my solution below.</p>