You need to sign in to do that
Don't have an account?
tinman44
Heap size?
All-
So I am getting this error on some of my Apex scripts "Apex heap size too large: 216581". I am trying to update a object that is linked to many accounts in a trigger/class. It proccesses about 14 of the 100+ accounts and then fails. At this point the documentation is not that straight forward about this error. I see the limit is 100,000 but that is about it.
Anybody have any insight about this error? How to clear the heap? How you have gotten around it?
Thanks in aadvance for any help/direction!
So its like you can not store more then 100,000 bytes of data in all your collection. You need to add logic in your code so that you process your collections before it reaches the limit and initialize them again to make more space!!
GreatG
All Answers
I got this same error when my code logic didn't handle a corner data case.
The method just didn't know what to do with this "special" record.
To fix this I changed my method to return false if anything was different about the record.
I know this answer is vague but that's all I got.
I have also gotten this message. Actually in multiple scripts. I've basically avoided this only once seen by rewriting what I did in a slightly different way. I cannot explain why this occurs and any further insight from a Salesforce representative would be helpful...
Thanks.
As far as I can tell, our code is pretty compliant with the governor limitations, so I don't know if there is much we can do to make it more efficient (although I'm sure someone out here could devise a more efficient method).
Is there any way to batch the processing requests, taking the heap size into consideration? Or, is this a limitation that we will have to live with for the time being?
Hello? Salesforce? Are you there???
So its like you can not store more then 100,000 bytes of data in all your collection. You need to add logic in your code so that you process your collections before it reaches the limit and initialize them again to make more space!!
GreatG
Hey,
Is there a good way to check the heap size at a given time?
Or a method to check all governor limits at once? that would be sweet.
Yes, you can check the heap size in runtime and check it against the limit.
Check out the LIMIT class in Apex, specifically the getHeapSize() and getLimitHeapSize() methods.