rajib_bahar_ptg
New Contributor III

I'd focus on understanding the codebase first. It'll help you decide what logic or data asset to keep or not keep when you try to optimize it. If you share the architecture of the application, the problem it solves, and some sample code here, it'll help others to give you better answer. Sorry my initial thoughts are generic.  

Try the suggestions in this article below... Are you calling too many action related functions? 

https://stackoverflow.com/questions/49567420/spark-requested-array-size-exceeds-vm-limit-when-writin...