function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kiru535Kiru535 

Heap Size error

Hello Experts,

I need urgent help on Heap size error issue.

I have done following fixes which is working perfectly in fullcopy Sandbox but in production still we are getting this issue.

-->Cleared all list variables
-->Declared Trasient keyword for unwanted variables
-->removed unwanted fields from SOQL select query.

Please advice what else needs to be done to overcome this issue in production.

Regards,
KK.
ShashForceShashForce
Please see if these suggestions help: http://blog.jeffdouglas.com/2010/08/16/managing-the-heap-in-salesforce-com/
Ankit AroraAnkit Arora
As you are already following some of the best practices, and getting error on production then sometimes it's because of the data. Just for testing try reducing the results in your query by putting the limit and check if it works on production or not (as what I predict is you are getting data in bulk on production and same data is not on sandbox)
David "w00t!" LiuDavid "w00t!" Liu
Add a bunch of these to your code and see where things are getting expensive:
System.debug('Current heap size limit is: ' + Limits.getHeapSize());