Salesforce Platform Developer I (legacy) — Question 18

A developer encounters APEX heap limit errors in a trigger.
Which two methods should the developer use to avoid this error? (Choose two.)

Answer options

Correct answer: C, D

Explanation

The correct answers, C and D, help manage memory usage effectively. Option C prevents memory bloat by ensuring collections are cleared after their purpose is served, while option D optimizes memory by processing records in smaller chunks rather than loading everything into one large collection. Options A and B do not directly address heap limit issues.