XML Pages to big

On Skuid version 10 my page sizes are ok but after updating to version 12 in sandbox some of my pages are throwing heap size errors. Is there a way to identify pages that the XML is too big without clicking into each page?

Hi Tami,  Have you cleared your browser cache?  If that does not help can you send me an example of one of your pages xml? ben.marshall@skuid.com

Hey Ben,

Thanks for the quick reply. I sent you an email.

Yes, there is a way that you can determine which of your pages are the biggest.

Step 1: Open Developer Console, and create a new Apex Class called “ComputeSkuidPageSizes”, with this as its body:

public class ComputeSkuidPageSizes {

public class Entry implements Comparable {
    private String name;
    private Integer len;
    public Integer compareTo(Object b) {
        Entry b2 = (Entry) b;
        return b2.len - this.len;
    }
    public Entry(String name, Integer len) {
        this.name = name;
        this.len = len;
    }
    public override String toString() {
        return this.name + ': ' + this.len;
    }
}

public static List<String> getPagesSortedBySize() {
    
    List<String> layoutFields = new List<String>{
        'skuid__Layout__c',
        'skuid__Layout2__c',
        'skuid__Layout3__c',
        'skuid__Layout4__c',
        'skuid__Layout5__c'
    };
    List<Entry> entries = new List<Entry>();
    for (List<SObject> pages : Database.query(
        'select Name, Id, ' + String.join(layoutFields,',') +
        ' from skuid__Page__c where skuid__Module__c != 'skuid'')) {
        for (SObject p : pages) {
            Integer length = 0;
            for (String fieldName : layoutFields) {
                if (p.get(fieldName) != null) {
                    length += String.valueOf(p.get(fieldName)).length();
                }
            }
            String name = String.valueOf(p.get('Name'));
            entries.add(new Entry(name, length));
        }
    }
    entries.sort();
    List<String> results = new List<String>();
    for (Entry e : entries) results.add(e.toString());
    return results;
}

}

Step 2: From Developer Console, run these lines of Anonymous Apex:

System.debug(‘‘);
for (String s : ComputeSkuidPageSizes.getPagesSortedBySize()) {
system.debug(s);
}
System.debug(’
’);

Step 3: Examine the results

  • The output of the above Anonymous Apex provides you with a list of all of your Skuid Pages sorted by biggest to smallest.

Thanks Zach! What is the max size for pages? Would that be found next to “len”?

For example this is what I see:

(1166528479)|VARIABLE_SCOPE_BEGIN|[6]|this|ComputeSkuidPageSizes.Entry|true|false ```13:32:19.78 (1166561255)|VARIABLE_ASSIGNMENT|[6]|this|{“len”:585823,“name”:“ASCM_Order_V2.5”}|0x62194648

The maximum size is 655360, so that page is under the limit.

I didn’t realize you were getting heap size errors in the Page Composer — that is probably another issue.

Can you Grant Login Access to Skuid Support so that we can take a look?

Hi Zach,

I am sorry I was not clear. The issue that I have experienced from version 10,11 and 12 on some of my bigger more complicated pages are when trying to open the Page Builder I get an “Apex heap size too large: 6616034” error and I can not get into the page builder. 

I have granted log in access to my sandbox. Please let me know if you need me to email the Company ID.

Here is a page with the issue: https://skuid.cs7.visual.force.com/apex/PageBuilder?id=a790P0000000nxhQAA

Hi Zach,

Do you need anything else from me to look into this issue?

Hi Tami, one of our support reps, Brian Lee, should be reaching out to you soon, if you can ensure that Login Access is granted, that would be very helpful.

Thank you!