Merge pull request #13887 from davidflanagan/bug939962

Bug 939962: attempt to reduce memory requirements for saving an edited i...(cherry picked from commit 08d96ee9678bef48a4540470ed96d32e962ff557)
Merge pull request #14474 from davidflanagan/bug939962-v1.2

Merge pull request #13887 from davidflanagan/bug939962