You can add some more memory by editing the mapred-site.xml
<property>
    <name>mapred.child.java.opts</name>
    <value>-Xmx4096m</value>
</property>
 
Alternatively you can also edit the hadoop-env.sh file 
add 
export HADOOP_OPTS="-Xmx5096m"
 
Hope this will resolve your error.