Skip to content

Invalidate the reflection metadata cache when new symbols are added. #8181

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

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

adrian-prantl
Copy link

Reflection context maintains several caches for TypeInfos and TypeRefs that also include types it got from LLDBTypeInforProvider, which reads types from DWARF. If new DWARF is available we need to invalidate these caches.

rdar://122432501

@adrian-prantl
Copy link
Author

@swift-ci test

@augusto2112
Copy link

Is this supposed to be only a test?

Reflection context maintains several caches for TypeInfos and TypeRefs
that also include types it got from LLDBTypeInforProvider, which reads
types from DWARF. If new DWARF is available we need to invalidate
these caches.

rdar://122432501
@adrian-prantl
Copy link
Author

Is this supposed to be only a test?

Fixed!

@adrian-prantl
Copy link
Author

@swift-ci test

Copy link

@augusto2112 augusto2112 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good change and worth merging as is. There is one downside with the current implementation though, as types that were cached and not affected by the new symbols will be recomputed and leak memory.

I wonder if it's worth preemptively finding a solution for that problem, or if extra symbols being loaded is not common enough to be concerned with at this point.

@adrian-prantl
Copy link
Author

@swift-ci test

1 similar comment
@adrian-prantl
Copy link
Author

@swift-ci test

@adrian-prantl
Copy link
Author

There is one downside with the current implementation though, as types that were cached and not affected by the new symbols will be recomputed and leak memory.

That's right. The memory will be freed only at the end of the process, as it's owned by SwiftLanguageRuntime.

@adrian-prantl adrian-prantl merged commit 05a060e into swiftlang:stable/20230725 Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants