Heap Size Exceeded error on a small query

I have a Skuid page with one data model that’s pulling one row of data, about 30 fields in total are being pulled. This seems like a relatively small query, yet I am still getting the following error when I load this page: Apex heap size too large: 6661265 Some of these fields are longer text fields (often 1000s of characters), so I’m wondering if that’s the reason? I tried using tabs to separate out the longer text fields, so that they’re not all loading at the same time (there are no more than a couple thousand characters per tab), but I’m still getting this error message. I referenced several of the posts on this forum for this error, but the suggestions given don’t seem relevant to this situation, since I technically have only a small amount of data being pulled. Does anyone know what I can do to get my pages to render? Thanks so much!

Hello Aparna,

Did you check were you querying any Long-TEXT fields (like Comments/Description fields) unnecessarily ?


To Avoid :

Remove your Long-TEXT feilds from Model and keep only the ones you need to show in your table .

Are you really in need of querying all the 30 fields ? 
I mean you could query the ones you have to display in table to User and user may go to each individual record to see all the fields in detail page.



Thanks for your reply – Yes, I do need each of the long text fields that I’m querying. It overwhelms the Salesforce page to have that much text displayed there – the other data and related lists become very difficult to access at that point. Also, I am only querying the fields that I’m displaying on my page.

For reference, the reason I have so many long text fields is that the data I’m displaying is from an application that a potential partner organization is submitting to our org – lots of lengthy narrative, but the people reviewing the app would like to see all of this text in one place.

You could try building a separate Skuid page for each of the long text fields, then an additional Skuid page to display them each in page includes on lazy load tabs.