BZ-1047269 Memory leak when running a high number of solver phases
(cherry picked from commit 3f408cf1c72362837f3584cbdb4875c31258bdc4)