Hi Gaurav,
How much physical memory is on your machine? It maybe that there is not enough memory allocated. If you are running ambari and other services, you should probably try to increase the memory up to 8 GB or more and more than 2 cores if your machine can handle it.
Regards,
Robert