title: Hadoop heap allocation
body: <p>I am having issues with Hadoop 2.5.1 not increasing the heap space increase that I am requesting. Hadoop doesn't seem to be respecting the mapred.child.java.opts property in the mapred-site.xml file.</p>
  
  <p>In my job I am doing the following:</p>
  
  <pre><code>R = new int[height * width];
  G = new int[height * width];
  B = new int[height * width];
  </code></pre>
  
  <p>Depending on the size of the image I pass job crashes saying </p>
  
  <p>Caused by: java.lang.OutOfMemoryError: Java heap space</p>
  
  <p>Which is understandable. I need to increase the heap space but for some reason Hadoop doesn't want to respect the change in my mapred-site.xml file.</p>
  
  <p>I added this to my mapred-site.xml and restarted</p>
  
  <pre><code> &lt;property&gt;
      &lt;name&gt;mapred.child.java.opts&lt;/name&gt;
      &lt;value&gt;-Xmx12072m&lt;/value&gt;
   &lt;/property&gt;
  </code></pre>
  
  <p>When that didn't work I added this to my mapred-env.sh and restarted</p>
  
  <pre><code>export HADOOP_JOB_HISTORYSERVER_HEAPSIZE=4000
  </code></pre>
  
  <p>When that didn't work I added this to my yarn-env.sh and restart</p>
  
  <pre><code>JAVA_HEAP_MAX=-Xmx4000m
  </code></pre>
  
  <p>When that didn't work I added this to my yarn-env.sh and restart</p>
  
  <pre><code>YARN_HEAPSIZE=4000
  </code></pre>
  
  <p>When that didn't work I added this to my hadoop-env.sh and restart</p>
  
  <pre><code>export HADOOP_HEAPSIZE=4000
  export HADOOP_NAMENODE_INIT_HEAPSIZE="3000"
  </code></pre>
  
  <p>I have restarted using start/stop-dfs.sh start/stop-all.sh start/stop-yarn.sh with their combinations. I have restarted the server and I have yet to see a change make a difference. </p>
  
  <p>I am at a loss of what I can do or what else I can change. </p>
  
  <p>Is there any way I can determine the heap size from within the job so I can try to debug this? </p>