Where does it crash? Locally or in the cloud?
If locally, you can give your local server a bigger java heap size Project>Settings>Your configiration> Server>Java heap.
But maybe it's good too check why you are running out of memory? What is your application doing?
If you are creating/committing 50,000 objects in one go, then the application will run out of memory. Try to execute or create in batches of around 1000-3000 objects instead of committing in one go.
i have the create and retrieves in batches of 50’s, but at the end, i commit all of the items (around 100,000) at once. Would you advice me to commit these items in batches too? if so, how would i use batching to commit it? Can i have a retrieve retrieving all the items i want to commit in batches , and committing at the end of the retrieve, then increment the offset?