Hi Supriya,
The “java.lang.OutOfMemoryError: Java heap space” error is triggered when you try to add more data into the heap space area, but there is not enough room for it. There is no other option. You have to increase the heap size if you want to have that much of data.
There is one more reason of this error is memory leakage but in your case it is not correct.
Thanks,
Hamendra