[SalesForce] Heap Size Limit in Salesforce

We have a mobile application which works with Salesforce. We want to support offline mode for this mobile application.

For that when we are loading the application, we need to store all data in mobile.
From mobile, we are calling a method of salesforce which returns Json data.

When we have more record and JSON string becomes more than 6 MB it throws heap size error.

Even if we retrieve data specific to a single account, few accounts has large number of contacts which can throw heap size error.

If we divide data call into multiple API call from mobile, it hits API call limit for a day.

So, can someone suggest what is the approach to store all the data on mobile device without hitting heapsize error and API limit error.

Thanks and Regards,
Ashish Shukla

Best Answer

If you are trying to load the data synchronously, then it will hit this limit of 6MB. I'd recommend you call asynchronously, which is nothing but using VisualForce Remoting functions.

Can you paste your code so that I'll point out a better way to go about it.

Thanks Akash

Related Topic