-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SIL: fix some memory leaks and add verification for leaked instructions #33888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
14cd172
to
d26d7b6
Compare
@swift-ci test |
Build failed |
Build failed |
d26d7b6
to
6894a08
Compare
@swift-ci test |
1 similar comment
@swift-ci test |
Build failed |
Build failed |
The leak happened in this scenario: 1. A function becomes dead and gets deleted (which means: it gets added to the zombie-list) 2. A function with the same name is created again. This can happen with specializations. In such a case we just removed the zombie function from the zombie-list without deleting it. But we cannot delete zombie functions, because they might still be referenced by metadata, like debug-info. Therefore the right fix is to resurrect the zombie function if a new function is created with the same name. rdar://problem/66931238
… SILModule. It's not needed because the names are stored in the ZombieFunctionTable anyway (this table was added later).
This fixes a memory leak: instructions of the static initializer block were not be freed. rdar://problem/66931238
* Leaks due to forwarding values * Leaks due to abort on errors rdar://problem/66931238
All instructions after an "unreachable" were not added to the function anyway and were leaking.
…option It had no effect, because such SIL is never generated anyway.
…odule destructor.
6894a08
to
56c857a
Compare
@swift-ci test |
1 similar comment
@swift-ci test |
Fixing some memory leaks:
1. related to zombie functions
The leak happened in this scenario:
In such a case we just removed the zombie function from the zombie-list without deleting it.
But we cannot delete zombie functions, because they might still be referenced by metadata, like debug-info.
Therefore the right fix is to resurrect the zombie function if a new function is created with the same name.
2. Let SILGlobalVariables be destroyed
Instructions of the static initializer block were not be freed.
3. Leaks in SILParser
Also: check for leaked instructions in the SILVerifier and in the SILModule destructor.
rdar://problem/66931238