I am getting the following error while executing the program.
And this is not always happening. The code contains some complex calculations with a large volume of data
This link is very useful when diagnosing crash dumps. However, if you're not using native code I would suggest upgrading (or perhaps even downgrading) your JVM to avoid this issue. That's often the fastest way to resolve such issues.