-
Notifications
You must be signed in to change notification settings - Fork 162
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
Memory management of Swift projections in .NET #314
Memory management of Swift projections in .NET #314
Conversation
Is this meant to mean managed instances of a Swift type or projection of the concept, akin to instances of |
IDisposable pattern (often combined with finalizer as a back-stop) is the typical .NET approach for dealing with unmanaged resources. What are these challenges? Is the problem that IDispose on every type leads to too verbose code that the users have to write? |
Do we have the same object-identity problems with Swift that we have with COM/WinRT/Objective-C? Generally, the object identity problem + unmanaged ref counting has been the driving force for runtime-based solutions. Otherwise, |
I would imagine so. Users are going to use dictionaries in their UI applications. I can't imagine being able to handle everything with |
This refers to managed instance of a Swift type that user interacts with.
I see a potential burden on users with nested types, where the user would need to implement
Can you provide some examples where |
I updated the docs to reflect provided feedback. We can proceed with |
Let's review it at a later stage when structs and classes are introduced. Since this is a minor change, please let me know if you'd like to merge it now or prefer to close this PR. |
More details added in #312 (comment). Closing this PR. |
Description
Currently, Swift types are typically projected as C# classes that implement
IDisposable
.Ideally, users should not need to be concerned with memory management in C#; it should be handled by the projection tooling. However, by projecting Swift types as
IDisposable
, there is a set of challenges that users need to address in order to release memory properly, which goes against the typical .NET approach.This has been handled differently depending on the runtime. Mono accomplishes this by exposing runtime APIs, while CoreCLR relies on C# exposed APIs. Additionally, there is a question of how COM interop handles this challenge.
Let's brainstorm ideas and update the design document based on feedback.