Apex heap size too large

In one of my skuid page for new records i am getting error as: Apex heap size too large: 9436523 Please can any one tell me why i am getting this error? Please reply ASAP and tell me of this error. Thanks. Arpit

Hello Arpit, The heap size limit is exceeded when a combination of too much data and metadata is retrieved into Skuid. Here are some possible causes of this issue, and way to resolve: 1 (most likely). You are requesting too many records in one of your Models. If you are working on a Skuid Page for creating new records, make sure that your Models have the “Load model data on page load” property (in the Model “Advanced” properties) turned OFF — if this is turned on, and your Models do not have any Conditions, then your models will try to load a TON of data, which will kill your page. 2) You are requesting too many Fields in your Models — usually only happens when you have multiple Models on your page with 100’s of fields in each. 3) You have too many Models, and those Models all are requesting Picklist fields that have lots and lots of Picklist values. Try consolidating your Models. Regards, Zach

Thanks Zach. It resolved my issue. Thanks.

We’ve hit this once or twice and used these hints to fix the issue. But today we’ve hit it differently. The page itself renders fine, but the Skuid page builder for the page returns the heap size error. So we can’t get at the page to fix it, which is a tad challenging. This is on v4.2.

That’s no fun. I’d try modifying your Page XML to remove a Model or some fields in a Model. You can do that by going to the URL: /apex/skuid__UI?page=PageXMLEdit&id=[YOUR_PAGE_ID]

Thanks Zach. Amazingly, I didn’t know about that URL, so that’s very handy. Looks like the issue was that we had a sizeable chunk of Javascript in the page as inline resources and it seems that removing that out to static resources might take the burden off the Page Builder page. So that’s easy enough to manage.

Hi Zach, hoping you have a recommendation for me on an Account Detail page.  I have a tab for Opportunities and I am trying to display all Opportunities (open and closed) that have a Ship Date greater than last quarter.  I ran into the same Apex heap size too large error.  The Account I was testing in preview has 700 Opportunities that fit the condition I set.  I realize this is a large data set but even just open Opptys for this particular account would be close to 400.
Is there any way we will be able to provide access to all these records through the Account Detail page?  I appreciate any guidance you have.

You can also reduce the number of fields you choose in the model. If you’ve got 300 fields in the model, then for sure you’ve be able to resolved the issue by reducing them down to the fields you see on the page.

Thanks Pat!  I only had about 15 fields in the model but I took a few out and the error went away.

i want 50,000 of row from master i am also getting the same error

Prashant, Salesforce standard SOQL queries typically hit the limit around 6000 records, give or take. Does the user need to see 50,000 rows? You may want to try an aggregate model - aggregate SOQL queries are able to process across many more rows. But even then, a lot depends on the data you’re aggregating (whether fields are indexed, how many fields you’re returning, etc.).

@Arpit said:
In one of my skuid page for new records i am getting error as: Apex heap size too large: 9436523 Please can any one tell me why i am getting this error? Please reply ASAP and tell me of this error. Thanks. Arpit

I am having this same issue with a single page. I have attempted to clean up models and max records per model, but not working.

We are using version 10.0.5

I would clone your page to create a text version. In that test version, delete each model one at a time until the page works. Then you will know which model and associated components are causing the issue.

Then you can delete each field one-by-one from that model to see what field/fields are causing the issue.

hint: it is usually long text or rich text fields that cause the this heap issues.

Not sure if it will fix anyone’s issue, but Skuid will return heap size error if you try to return too much data on page load. Each individual model retrieves acceptable amount of data, but on page load (when they are loaded together, I assume) it goes over the limit.

Work around: disable Load data on page load, add even triggered action sequence which is triggered when page finished loading, add the models you want to query to the action sequence.

Hope this helps someone.