Catastrophic memory usage with lazy member variable

Number:rdar://36412111 Date Originated:Jan 10th 2018
Status:Open Resolved:
Product:macOS/Foundation Product Version:10.12.6/9.2
Classification:Bug Reproducible:Always

Modification of a member of a collection that is itself a lazy instance variable causes the collection to be copied.

Steps to Reproduce:
There is a sample Xcode project at

Expected Results:
Modification of the collection should be in-place.

Actual Results:
The collection is copied before each write. If the collection is not trivially small, frequent modifications significantly degrade application performance.

Xcode Version 9.2 (9C40b)
macOS 10.12.6 (16G1114)


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!