Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Yes you can instantiate multiple objects inside loops. There are two governor limits which can be reached here: CPU Time and Heap Size There used to be a Number of Code statements limit but starting winter 14 it has been replaced with the CPU Time limit. So you have to do some testing on this to make sure your code does not exceed either of the governor limits. Regards, Satish Kumar
Yes you can instantiate multiple objects inside loops.
There are two governor limits which can be reached here: CPU Time and Heap Size
There used to be a Number of Code statements limit but starting winter 14 it has been replaced with the CPU Time limit.
So you have to do some testing on this to make sure your code does not exceed either of the governor limits.
Regards,
Satish Kumar
-Glyn
Thanks for your suggestion. If I am doing any select operation on an object should I be creating instance inside for loop.
I want some scneraios which tells why I am instiaiting object inside loop and why I am instatiating outside the loop.
Regards