Open
Description
Describe the bug
It is possible to make a program that when compiled and run works correctly, but then if a small change is made and run again it will consume a large amount of memory and then crash at runtime.
Further, if the target is cleaned and run again it works fine, which makes me think it is a bug with incremental compilation.
This happens in Swift 5.5-5.7 and perhaps earlier.
Steps To Reproduce
Steps to reproduce the behavior:
- Open the demo project: incremental-bug.zip
- Navigate to Feature.swift
- Run the application and observe that it completes successfully.
- Uncomment the 3 lines in Feature.swift and run again.
- Observe that the application consume ~1.5GB of memory and then crashes.
- Clean the target (cmd+shift+K) and run again to observe that it completes successfully again.
Expected behavior
The application should not crash and should print the following to the console:
Sending .action1("Hello")
Running action1("Hello")
Sending .action2
Running action2
Environment (please fill out the following information)
- OS: macOS 12.4 (21F79)
- Xcode 13.2.1 (13C100) / Swift 5.5