You need to sign in to do that
Don't have an account?
Amit Rangari 1
How governor limits are enforced?
I have question about two governor limits;
1. CPU time
2. Heap Size
Looking at some of the testing failing arbitrory, we came to following conclusion:
1. CPU time limit is enforced asynchronous way. That means some times the apex code will terminate at ~11k msec and sometimes ~15k. Thus some tests may pass although it took more than 10k msec, just because the limit-watcher didnt catch the violoation.
However, for Heapsize limit - we were expecting this to be very hard and would always be enforced synchronously. However recently we observed that one job which was failing for heapsize in one batch, didnt fail. the only small change we had, that we added more debug data to the log objects we created (!!)
We would like to know if this is not the case.
If the limits are not enforced very strictly, sometimes apex code completes successfully and sometimes it doesnt.
1. CPU time
2. Heap Size
Looking at some of the testing failing arbitrory, we came to following conclusion:
1. CPU time limit is enforced asynchronous way. That means some times the apex code will terminate at ~11k msec and sometimes ~15k. Thus some tests may pass although it took more than 10k msec, just because the limit-watcher didnt catch the violoation.
However, for Heapsize limit - we were expecting this to be very hard and would always be enforced synchronously. However recently we observed that one job which was failing for heapsize in one batch, didnt fail. the only small change we had, that we added more debug data to the log objects we created (!!)
We would like to know if this is not the case.
If the limits are not enforced very strictly, sometimes apex code completes successfully and sometimes it doesnt.
Yes, this is expected, and perfectly normal. Each time you call System.debug, the object you pass in must serialized, even if the system eventually doesn't end up putting anything in to the log, and even if no log is generated at all. You should always remove all debug statements from your code before deploying to production. If you need to see the state of the system, consider using Check https://help.salesforce.com/articleView?id=code_dev_console_checkpoints_setting.htm&type=5 Pointsinstead. This will allow you to inspect the state of the heap when the Check Point is triggered in the Developer Console.
#copied from Google. I hope the answer is okey for your question.
Thanks
Mohamed Ithris
Can the same set of data for given program give heapsize issue consistently when executed number of times? Our observations are different.
please follow the below link:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha