Skip to content
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

Merge new Native memory model support into the mainline #2914

Closed
qwwdfsad opened this issue Sep 2, 2021 · 0 comments
Closed

Merge new Native memory model support into the mainline #2914

qwwdfsad opened this issue Sep 2, 2021 · 0 comments
Labels

Comments

@qwwdfsad
Copy link
Member

@qwwdfsad qwwdfsad commented Sep 2, 2021

We have announced our new experimental memory manager: https://blog.jetbrains.com/kotlin/2021/08/try-the-new-kotlin-native-memory-manager-development-preview/ and expect our users to check it out.

This experience cannot be full without kotlinx.coroutines, but unfortunately special support is required. It forces us to support "one more fork" of coroutines, but what's more important -- it forces users to depend on dev builds of unspecified quality, and also somehow to be aware of their existense.

My proposal is to leverage isExperimentalMM stdlib API (available only in 1.6.0+) and merge the support of the new MM in the mainline, enabling new "sharing" behaviour (and also implementations of Dispatchers.Main, Dispatchers.Default and new*Context()) conditionally. If the new MM is disabled, we can fallback to our single-threaded mode.

@qwwdfsad qwwdfsad added the native label Sep 2, 2021
yorickhenning pushed a commit to yorickhenning/kotlinx.coroutines that referenced this issue Jan 28, 2022
…otlin#2833)

* Support of new K/N memory model
* Dispatchers.Default backed by a pool of workers on Linux and by global_queue on iOS-like
* Implementation of Dispatchers.Main that uses the main queue on iOS and default dispatcher on other platforms (Kotlin#2858)
* Introduced newSingleThreadDispatcher and newFixedThreadPoolDispatcher
* Use proper reentrant locking and CoW arrays on new memory model, make TestBase _almost_ race-free
* More thread-safety in Native counterpart and one more test from native-mt
* Source-set sharing for tests shared between JVM and K/N
* Wrap Obj-C interop into autorelease pool to avoid memory leaks

Fixes Kotlin#2914

Co-authored-by: dkhalanskyjb <52952525+dkhalanskyjb@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant