-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[SR-927] Integrate leaks infrastructure into stdlib unittests #43539
Comments
Some notes: 1. Stdlib unit tests runs tests in parallel processes but within each process runs the tests sequentially. We take advantage of this setup to ease the amount of concurrency work that is necessary. If at some point this changes, we will need to be much more careful about creating the global set and in fact will need to do the work to create multiple live object sets and only modify the one associated with the given test thread. That would be unfortunate = (... but luckily is not the case currently! 2. Currently the stdlib unit tests does do some leaks checking, but this checking: |
The code used by the benchmark is in DriverUtils.swift in the sections ifdefed by SWIFT_RUNTIME_ENABLE_LEAK_CHECKER |
libobjc's test machinery has a similar mechanic. Some notes from experience there:
|
Resetting assignee on all Starter Bugs not modified since 2018. |
Additional Detail from JIRA
md5: af9683a46d2c1fd2060e2a6887b581f4
Issue Description:
Currently we have special infrastructure for precise leaks checking that we use to check for leaks in our benchmarks.
The way this works is that when the pass -DSWIFT_RUNTIME_ENABLE_LEAK_CHECKER is set to yes, the runtime provides the two entry points:
where name is a string with the name of the test being run. When startTrackingObjects is called, a global set is initialized. This is our "live object set". From that point forward, whenever we allocate a swift or objective-c object, we add it to the set. When ever we deallocate such an object, we remove the object from that set.
When stopTrackingObjects is called, the runtime emits via simple json the current state of the live object set.
The nice thing about this approach is that it enables fine-grained leaks testing of specific tests.
As mentioned at the top of the description, currently the leak checker has been integrated only into the benchmarks. This bug is to track the work of making changes to stdlib unit tests to enable the leaks checker to work on the stdlib unit tests.
This is a non-trivial amount of work, but would be a good starter bug that would improve the quality of the compiler.
The text was updated successfully, but these errors were encountered: