Mapreduce local mode - out of memory/heap error

I get java.lang.OutOfMemoryError error when I try to run a mapreduce job in local mode @ gw01.itversity.com node. The input file size is very small. So I think it is not because of the file that this error is occuring.

However when I run this mapreduce program in yarn mode it is working perfect.

Is there anyway this java.lang.OutOfMemoryError error can be resolved in gateway node.

It is common to hit out of memory issues in local mode. I do not recommend you to run in local mode.