If you reference fields on a list of objects that is still in scope, like jobs, each job record in the list will become fully populated with data from the database as you reference it, and that memory will not be freed until the entire jobs list goes out of scope.
Comparing your two last examples, I don't understand how that change alone saves memory.
ReplyDeleteWas the your "jobs" query exactly the same in both of those cases? Or did you use .iterator() in the latter example?
If you reference fields on a list of objects that is still in scope, like jobs, each job record in the list will become fully populated with data from the database as you reference it, and that memory will not be freed until the entire jobs list goes out of scope.
ReplyDelete