Salesforce Certified Platform Developer II — Question 128

A developer encounters an error that states that the Apex heap size is exceeded.
Which technique may reduce heap size?

Answer options

Correct answer: D

Explanation

Using SOQL for loops allows you to process records in smaller chunks, which can significantly reduce the heap size by limiting the amount of data held in memory at one time. The other options, while they may have their own benefits, do not directly address the issue of heap size in the same effective manner as using SOQL for loops.