# memory-model

Published articles for memory-model.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## MLIR-MRacle: Memory-Model-Aware Metamorphic Fuzzing of Concurrent MLIR

DevFeed: [MLIR-MRacle: Memory-Model-Aware Metamorphic Fuzzing of Concurrent MLIR](<https://devfeed.tech/articles/mlir-mracle-memory-model-aware-metamorphic-fuzzing-of-concurrent-mlir-142218.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.24804>)

Author: Aaron Gabayoyo, Aidan Dakhama, Ajitha Rajan

Published: 2026-11-19T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Software Engineering](<https://devfeed.tech/sources/arxiv-software-engineering.md>)

Topics: [mlir](<https://devfeed.tech/topics/mlir.md>), [Fuzzing/Fuzz testing](<https://devfeed.tech/topics/fuzzing.md>)

Tags: [bug](<https://devfeed.tech/tags/bug.md>), [compilers](<https://devfeed.tech/tags/compilers.md>), [concurrent](<https://devfeed.tech/tags/concurrent.md>), [coverage](<https://devfeed.tech/tags/coverage.md>), [cs-se](<https://devfeed.tech/tags/cs-se.md>), [execution](<https://devfeed.tech/tags/execution.md>), [extension](<https://devfeed.tech/tags/extension.md>), [fixed](<https://devfeed.tech/tags/fixed.md>), [fuzzing](<https://devfeed.tech/tags/fuzzing.md>), [hardware](<https://devfeed.tech/tags/hardware.md>), [memory-model](<https://devfeed.tech/tags/memory-model.md>), [mlir](<https://devfeed.tech/tags/mlir.md>), [openmp](<https://devfeed.tech/tags/openmp.md>), [optimisation](<https://devfeed.tech/tags/optimisation.md>), [oracles](<https://devfeed.tech/tags/oracles.md>)

### AI overview

MLIR-MRacle tests concurrent MLIR compiler lowerings by applying metamorphic transformations gated by the target memory model, keeping both program variants well defined. It runs each repeatedly and uses one of two statistical oracles to compare outcome sets or distributions, with a libafl coverage-guided driver for continuous fuzzing. In an Armv8 case study, it ran more than 145,000 trials across four configurations, reached up to 93,600 compiler coverage edges, and found an OpenMP dialect verifier bug that has since been fixed upstream. The abstract says transformations, memory models, oracles, and execution backends are extensible.

### Source excerpt

arXiv:2611.24804v1 Announce Type: new Abstract: Multi-level compilers built on MLIR lower concurrent programs through many stages towards targets with potentially drastically different memory models, where an optimisation which appears reasonable, can silently change program behaviour. Testing these lowerings is hard: a concurrent program often has no single expected outcome, and existing MLIR fuzzers often assume determinism. We present MLIR-MRacle, a memory-model-aware metamorphic fuzzer for concurrent MLIR programs. MLIR-MRacle applies metamorphic relations gated by the target memory model, so that both the original and transformed programs remain well defined - executing both repeatedly, and comparing their outcome sets or distributions withone of two statistical oracles. A coverage guided campaign driver built on libafl is used to perform continuous fuzzing. MRs, memory models, oracles, and execution backends all provide extension points for future researchers and compiler engineers to build off this package. In a case study on Armv8 hardware, MLIR-MRacle ran over 145k trials across four configurations, reaching up to 93.6k compiler coverage edges, and found a bug in the OpenMP dialect verifier that has since been fixed upstream. Video: https://youtu.be/lKtGk0H97Ts?si=dWLUHl2CJ24ep6JY

## D\\'ej\\\`a View: A Shared Working-Memory Model for Visual Tasks

DevFeed: [D\\'ej\\\`a View: A Shared Working-Memory Model for Visual Tasks](<https://devfeed.tech/articles/d-ej-a-view-a-shared-working-memory-model-for-visual-tasks-141856.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.23177>)

Author: Mranmay Shetty, Gabriel Kreiman

Published: 2026-11-18T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Machine Learning](<https://devfeed.tech/sources/arxiv-machine-learning.md>)

Topics: [Image](<https://devfeed.tech/topics/image.md>)

Tags: [cs-cv](<https://devfeed.tech/tags/cs-cv.md>), [cs-lg](<https://devfeed.tech/tags/cs-lg.md>), [history](<https://devfeed.tech/tags/history.md>), [image](<https://devfeed.tech/tags/image.md>), [memory](<https://devfeed.tech/tags/memory.md>), [memory-model](<https://devfeed.tech/tags/memory-model.md>), [model](<https://devfeed.tech/tags/model.md>), [performance](<https://devfeed.tech/tags/performance.md>), [q-bio-nc](<https://devfeed.tech/tags/q-bio-nc.md>), [tasks](<https://devfeed.tech/tags/tasks.md>)

### AI overview

Déjà View combines dynamic activity with temporary associations between image features to support five visual working-memory tasks. A single trained model switches tasks using explicit response cues, covering sample memory amid distractors, distractor categorization while retaining a sample, and judging whether an image is new. In the tested conditions, delays had little effect on sample-memory performance, but exposure to more images increased false alarms even when target recency was held equal. In a combined memory-and-categorization task, accuracy across questions fell as more questions were asked despite robust sample memory. Performance remained stable across 40 brief trials per task.

### Source excerpt

arXiv:2611.23177v1 Announce Type: cross Abstract: A working-memory model must remember stimuli and use its memory flexibly to perform different tasks. Here we introduce a model of working memory for images that combines dynamic activity with temporary associations between image features. We train the model on five tasks, including remembering a sample while other images are presented, categorizing distractor images while remembering the sample, and determining whether an image is new or has been presented before. The same trained model performs all tasks, guided by explicit cues about which response is required. We use this flexible memory model to ask how delay, distraction, and image history affect performance. Delays have little effect on sample-memory performance for the delays we tested, while seeing more images leads to more false alarms even when the target image appeared equally recently in all cases. On the sample-memory-plus-categorization task, the probability of correct responses on all questions decreases as more questions are asked, despite robust sample-memory performance. Finally, the model maintains stable performance across 40 brief trials of each task under the tested conditions. Together, these results demonstrate how a single working-memory system can be flexibly used to perform different tasks, and how its errors depend on both previous images and task demands.

## Spectral Quantum Memory for Implicit Neural Representations

DevFeed: [Spectral Quantum Memory for Implicit Neural Representations](<https://devfeed.tech/articles/spectral-quantum-memory-for-implicit-neural-representations-116958.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.04574>)

Author: Daniel A. Moroz-Broitman, Eliya Nachmani

Published: 2026-11-04T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Artificial Intelligence](<https://devfeed.tech/sources/arxiv-artificial-intelligence.md>), [arXiv: Machine Learning](<https://devfeed.tech/sources/arxiv-machine-learning.md>)

Topics: [Neural Network](<https://devfeed.tech/topics/neural-network.md>), [model architecture](<https://devfeed.tech/topics/model-architecture.md>), [quantum mechanics](<https://devfeed.tech/topics/quantum-mechanics.md>), [Representation learning](<https://devfeed.tech/topics/representation-learning.md>)

Tags: [alignment](<https://devfeed.tech/tags/alignment.md>), [architectures](<https://devfeed.tech/tags/architectures.md>), [audio](<https://devfeed.tech/tags/audio.md>), [band](<https://devfeed.tech/tags/band.md>), [benchmarks](<https://devfeed.tech/tags/benchmarks.md>), [blocks](<https://devfeed.tech/tags/blocks.md>), [capacity](<https://devfeed.tech/tags/capacity.md>), [coherent](<https://devfeed.tech/tags/coherent.md>), [condition](<https://devfeed.tech/tags/condition.md>), [continuous](<https://devfeed.tech/tags/continuous.md>), [coupling](<https://devfeed.tech/tags/coupling.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [cs-lg](<https://devfeed.tech/tags/cs-lg.md>), [hybrid](<https://devfeed.tech/tags/hybrid.md>), [image](<https://devfeed.tech/tags/image.md>), [independent](<https://devfeed.tech/tags/independent.md>), [input](<https://devfeed.tech/tags/input.md>), [layers](<https://devfeed.tech/tags/layers.md>), [memory](<https://devfeed.tech/tags/memory.md>), [memory-model](<https://devfeed.tech/tags/memory-model.md>), [neural](<https://devfeed.tech/tags/neural.md>), [quant-ph](<https://devfeed.tech/tags/quant-ph.md>), [quantum](<https://devfeed.tech/tags/quantum.md>)

### AI overview

SQMM links sequential quantum INR bands through a shared coherent memory: each band reads the stored state, processes its own coordinate input, and writes part of its state back for later bands to use. For input-independent memory read and write layers, the authors prove that the memory state's operator-valued Fourier support lies within the Minkowski sum of the initial memory spectrum and the local band spectra; memory coupling adds no new primitive frequencies. Later bands can condition their Fourier coefficients on earlier stored spectral content. The authors use this result to motivate a spectral memory alignment loss and report improved audio and image reconstruction over compact QINR and INR baselines. The abstract provides no benchmark details or quantitative results.

### Source excerpt

arXiv:2611.04574v1 Announce Type: cross Abstract: Implicit neural representations (INRs) model signals as continuous functions from coordinates to values, but their performance depends strongly on how spectral capacity is allocated. Yet most Quantum INR (QINR) architectures treat spectral components as independent outputs of separate quantum blocks. We introduce the Spectral Quantum Memory Model (SQMM), a memory coupled quantum INR in which sequential hybrid data reuploading layers (bands) communicate through a shared coherent quantum memory register. Each band reads the memory, computes on its own coordinate upload, and writes part of its state back, so later bands can build on the computation of earlier ones. When memory read and write layers are input independent, we prove that the memory state forms an operator valued Fourier series whose support is contained in the Minkowski sum of the initial memory spectrum and the local band spectra. Downstream bands then condition their Fourier coefficients on the spectral content stored by earlier bands, and the memory coupling creates no new primitive frequencies. This theory motivates a spectral memory alignment loss that encourages memory to encode the spectrum expressed by the deployed prefix of the model. Across audio and image reconstruction benchmarks, SQMM improves over compact QINR and INR baselines.

## Immutability is a concurrency strategy, not a style preference

DevFeed: [Immutability is a concurrency strategy, not a style preference](<https://devfeed.tech/articles/immutability-is-a-concurrency-strategy-not-a-style-preference-77003.md>)

Original publisher: [Read original article](<https://ankit-rana.com/logs/64-immutability-is-a-concurrency-strategy/>)

Author: hello@ankit-rana.com

Published: 2026-10-08T00:00:00Z

Content type: article

Language: en

Sources: [Ankit Rana | Mechanical Sympathy](<https://devfeed.tech/sources/ankit-rana-mechanical-sympathy.md>)

Topics: [thread safe data sharing](<https://devfeed.tech/topics/thread-safe-data-sharing.md>), [Distributed Systems & Parallel Computing](<https://devfeed.tech/topics/distributed-systems-parallel-computing.md>)

Tags: [concurrency](<https://devfeed.tech/tags/concurrency.md>), [design](<https://devfeed.tech/tags/design.md>), [immutability](<https://devfeed.tech/tags/immutability.md>), [java](<https://devfeed.tech/tags/java.md>), [memory-model](<https://devfeed.tech/tags/memory-model.md>), [thread-safety](<https://devfeed.tech/tags/thread-safety.md>), [threads](<https://devfeed.tech/tags/threads.md>)

### AI overview

The article explains how immutable objects and snapshot replacement can prevent readers from observing partially updated shared state. It covers safe publication, defensive copies, allocation tradeoffs, and cases where local mutation or lifecycle-driven mutability remain appropriate.

### Source excerpt

An object that cannot change after construction is safe to share across threads with no lock, no volatile, and no reasoning about happens-before, because there is no write for a reader to miss. That removes an entire category of bug rather than mitigating it. The usual objection is allocation cost, and it is generally the wrong trade to optimise: short lived objects are cheap to collect, while a data race is invisible in testing and reproduces once a quarter in production.

## 0.6.6: Memory Management Improvements

DevFeed: [0.6.6: Memory Management Improvements](<https://devfeed.tech/articles/0-6-6-memory-management-improvements-22390.md>)

Original publisher: [Read original article](<https://www.red-lang.org/2025/03/066-memory-management-improvements.html>)

Author: Nenad Rakocevic (noreply@blogger.com)

Published: 2025-03-19T16:11:00Z

Content type: release

Language: en

Sources: [Red](<https://devfeed.tech/sources/red.md>)

Topics: [Memory Safety](<https://devfeed.tech/topics/memory-safety.md>), [Memory Leaks](<https://devfeed.tech/topics/memory-leaks.md>)

Tags: [external](<https://devfeed.tech/tags/external.md>), [font](<https://devfeed.tech/tags/font.md>), [fonts](<https://devfeed.tech/tags/fonts.md>), [gc](<https://devfeed.tech/tags/gc.md>), [images](<https://devfeed.tech/tags/images.md>), [improvements](<https://devfeed.tech/tags/improvements.md>), [management](<https://devfeed.tech/tags/management.md>), [memory](<https://devfeed.tech/tags/memory.md>), [memory-management](<https://devfeed.tech/tags/memory-management.md>), [memory-model](<https://devfeed.tech/tags/memory-model.md>), [resources](<https://devfeed.tech/tags/resources.md>), [series](<https://devfeed.tech/tags/series.md>)

### AI overview

Red 0.6.6 improves memory management by adding cleanup for external resources and making garbage-collector stack scanning more precise. A new manager tracks resources such as image bitmap buffers and font handles associated with unreachable face! or font! objects and frees them. Previously, the conservative native-stack scanner could mistake floating-point values for pointers, risking rare corruption or crashes, and could not support node-frame collection. The R/S compiler now emits bit-array hints identifying arguments and local variables that may hold series or node pointers; function calls push an offset so the scanner can find the matching map and examine only marked stack slots. The excerpt cuts off during the explanation of how those slots are further analyzed.

### Source excerpt

This new milestone brings many low-level improvements to Red's memory management and garbage collecting. Most of those are long-planned additions needed to complete the internal memory model and make it robust enough for the future stable Red v1.0. First, here is a simplified overview of the Red memory model (existing parts in green color, new parts in orange, non-Red parts in blue): All Red values are stored in series. Some Red values require one or more buffers to hold their content. The values can never reference a buffer directly, but only through a node reference, to enable relocation when expanding the series buffer or when moving it around during compaction by the GC. Now let's dive into the hairy details! External resources GC The Red/View engine backends rely on external resources provided by the OS. Among those resources, some are linked to face! or font! object and require special care when those objects are not reachable anymore. So far, our GC (Garbage Collector) was not able to release such resources (images bitmap buffers and fonts handles), as unreachable Red aggregate values are seeing as simple series during the sweeping GC stage. In order to improve that, we have added an external resources manager, that will track and free unused resources, allowing now unrestricted images and fonts usage! Accurate GC The Red GC relies on allocated memory walking and native stack scanning to identify live Red values. Scanning the native stack can be challenging. The scanner used so far a conservative approach, which is simpler, but can lead to corruptions or crashes in rare cases (e.g. a floating point number being mistaken for a series or node pointer). Moreover, such approach precluded from having a nodes frame GC, as there was no way to accurately identify node pointers on the stack. This is now solved. The plan was always to make it precise when getting closer to a Red v1.0 and that's what we did in this release. In order to achieve that, several key addition

## Testing the Kotlin Native memory model

DevFeed: [Testing the Kotlin Native memory model](<https://devfeed.tech/articles/testing-the-kotlin-native-memory-model-25954.md>)

Original publisher: [Read original article](<https://medium.com/@kpgalligan/testing-the-kotlin-native-memory-model-d3ccd2c2810f?source=rss-c2f810aa7890------2>)

Author: Kevin Galligan

Published: 2021-10-03T16:35:56Z

Content type: tutorial

Language: en

Sources: [Kevin Galligan](<https://devfeed.tech/sources/stories-by-kevin-galligan-on-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Test automation](<https://devfeed.tech/topics/test-automation.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [Open Source](<https://devfeed.tech/topics/open-source.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>)

Tags: [bugs](<https://devfeed.tech/tags/bugs.md>), [github-actions](<https://devfeed.tech/tags/github-actions.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [kotlin-native](<https://devfeed.tech/tags/kotlin-native.md>), [memory-model](<https://devfeed.tech/tags/memory-model.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

The article encourages Kotlin/Native library maintainers to test the experimental memory model and report bugs while it matures. Kermit runs three Gradle builds: its published Kotlin 1.5.31 setup, Kotlin 1.6.0-M1 with the strict model, and 1.6.0-M1 with `-Pkotlin.native.binary.memoryModel=experimental`. The Kotlin version can be overridden with `-PKOTLIN_VERSION=1.6.0-M1`. For that Kotlin milestone, the excerpt says GitHub Actions `macos-11` provides required Xcode 12.5, whereas `macos-latest` has Xcode 12.4. Kermit found a minor issue; the author says one successful test run need not remain enabled, though they expect to run both models for a while after 1.6.0 releases. A minimal sample project is offered for reproducing failures, with `ThreadHelper.doInBackgroundUnfrozen` for running code on another thread; bug reports should select Kotlin as the project.

### Source excerpt

Memory joke Kotlin/Native's strict memory model has been a common topic of interest and/or concern in the community for some time. The arrival of the new memory model will remove what many consider an adoption blocker. However, creating and testing a new memory model is a significant undertaking. It is tempting to wait until the new memory model is "ready", but the community can help accelerate the maturing of the platform by testing the new model and reporting bugs. We are starting to run our open source library tests against the new memory model. Just turning it on for Kermit found a relatively minor issue. If you publish a library, it would be great if you could turn on the new memory model and see if things work. Although everybody's config is different, here's how we do it. Kermit's Kotlin version is in the gradle.properties file. GROUP=co.touchlab VERSION_NAME=1.0.0-rc4 KOTLIN_VERSION=1.5.31 # etc... Kermit/gradle.properties at main - touchlab/Kermit That makes turning on the memory model simple. We can pass in a different Kotlin version and memory model flag, both as gradle properties. Currently we run tests 3 times. First with Kotlin 1.5.31, which is our published version. Then Kotlin 1.6.0-M1, but with the strict memory model, then Kotlin 1.6.0-M1 and the new memory model. In the Github Actions script, here are the lines: - name: Build run: ./gradlew build --no-daemon --stacktrace - name: Build 1.6 run: ./gradlew build -PKOTLIN_VERSION=1.6.0-M1 --no-daemon --stacktrace - name: Build 1.6 nmm run: ./gradlew build -PKOTLIN_VERSION=1.6.0-M1 \ -Pkotlin.native.binary.memoryModel=experimental --no-daemon \ --stacktrace Param -PKOTLIN_VERSION=1.6.0-M1 sets the Kotlin verison, and -Pkotlin.native.binary.memoryModel=experimental turns on the new memory model. Also FYI, macos-latest is a little old and has Xcode 12.4. macos-11 has Xcode 12.5, which is required for Kotlin 1.6.0-M1. Obviously, if you run those once and they work fine, you don't need to leave them on. We

## KMM Oddity #1: Interface methods with underscores

DevFeed: [KMM Oddity #1: Interface methods with underscores](<https://devfeed.tech/articles/kmm-oddity-1-interface-methods-with-underscores-24737.md>)

Original publisher: [Read original article](<https://medium.com/xorum-io/kmm-oddity-1-interface-methods-with-underscores-21523b8ed797?source=rss----92bb7980cc9f---4>)

Author: Yev Kanivets

Published: 2021-09-20T04:23:21Z

Content type: article

Language: en

Sources: [xorum.io](<https://devfeed.tech/sources/xorum-io-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [IntelliJ IDEA](<https://devfeed.tech/topics/intellij-idea.md>), [interface](<https://devfeed.tech/topics/interface.md>), [class](<https://devfeed.tech/topics/class.md>)

Tags: [alpha](<https://devfeed.tech/tags/alpha.md>), [android](<https://devfeed.tech/tags/android.md>), [beta](<https://devfeed.tech/tags/beta.md>), [bugs](<https://devfeed.tech/tags/bugs.md>), [class](<https://devfeed.tech/tags/class.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [embedded](<https://devfeed.tech/tags/embedded.md>), [frameworks](<https://devfeed.tech/tags/frameworks.md>), [header](<https://devfeed.tech/tags/header.md>), [interface](<https://devfeed.tech/tags/interface.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [interop](<https://devfeed.tech/tags/interop.md>), [ios](<https://devfeed.tech/tags/ios.md>), [kmm](<https://devfeed.tech/tags/kmm.md>), [kmp](<https://devfeed.tech/tags/kmp.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [kotlin-multiplatform-mobile](<https://devfeed.tech/tags/kotlin-multiplatform-mobile.md>), [kotlin-native](<https://devfeed.tech/tags/kotlin-native.md>), [memory-model](<https://devfeed.tech/tags/memory-model.md>), [mobile](<https://devfeed.tech/tags/mobile.md>)

### AI overview

Kotlin/Native may add trailing underscores to Objective-C method names when separate interfaces declare methods such as `eat(food:)` with different argument types; the example becomes `eat(food_:)` on iOS, while Android works as expected. Extracting the embedded `Food` classes does not change the generated header. Giving both methods the same argument type avoids the suffix, and replacing the interfaces with abstract classes (or classes) also preserves the expected names. The article additionally suggests renaming clashing methods or arguments. It describes the suffix as annoying but not critical.

### Source excerpt

Kotlin Multiplatform attracts more and more developers every day. Especially after the technology transitioned to the Alpha stage. On its way to Beta, KMP removes all major hassles (Memory Model, for example). Nonetheless, you can still find "a few" more minor bugs and oddities reported in Kotlin's YouTrack. They aren't blockers for using KMP in your production application but may cost you several hours of wondering what and why is happening in your mobile application (mainly on iOS). I faced many such issues myself since I've started using Kotlin Multiplatform Mobile two years ago. In this series of articles, I'll share my favorite oddities of KMM with explanations and workarounds (if possible). Kotlin/Native Obj-C interop Shared KMM modules are written in Kotlin, hence can be used in Android native applications as it is. On iOS, it's more complicated because of Objective-C and Swift, which can't directly use Kotlin code. Kotlin/Native plugin compiles shared KMM modules to iOS frameworks, which contain binary and Obj-C header. You can find them in the build folder of the shared module, under bin/iOS/. Many concepts of Kotlin don't exist in Obj-C, so specific shortcuts and workarounds need to be applied to make it work. It is where some oddities start appearing. Interface methods naming clash Let's say we have two types of pets -- Dog and Cat, which we need to feed with some specific Food. In Kotlin, we could represent that with two interfaces, each having an internal (embedded) Food class. https://medium.com/media/b868e0383cdc20566aef171daa863a87/href It works perfectly well in Android, but on iOS Dog will have eat(food_:) method instead of eat(food:). Where does that underscore suffix come from? And why do we need it? It looks like Kotlin/Native compiler thinks there will be a clash between eat(food:) methods of Dog and Cat interfaces, so it's safer to make them different by implicitly adding an underscore to the 2nd one. I'm not sure it will become a problem and i

## Kotlin 1.5.30 and KMM/KMP

DevFeed: [Kotlin 1.5.30 and KMM/KMP](<https://devfeed.tech/articles/kotlin-1-5-30-and-kmm-kmp-25951.md>)

Original publisher: [Read original article](<https://medium.com/@kpgalligan/kotlin-1-5-30-and-kmm-kmp-2ba19af65fe7?source=rss-c2f810aa7890------2>)

Author: Kevin Galligan

Published: 2021-08-27T16:15:39Z

Content type: article

Language: en

Sources: [Kevin Galligan](<https://devfeed.tech/sources/stories-by-kevin-galligan-on-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>)

Tags: [1-5](<https://devfeed.tech/tags/1-5.md>), [adoption](<https://devfeed.tech/tags/adoption.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [kmm](<https://devfeed.tech/tags/kmm.md>), [kmp](<https://devfeed.tech/tags/kmp.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [kotlin-native](<https://devfeed.tech/tags/kotlin-native.md>), [memory](<https://devfeed.tech/tags/memory.md>), [memory-model](<https://devfeed.tech/tags/memory-model.md>), [milestone](<https://devfeed.tech/tags/milestone.md>), [preview](<https://devfeed.tech/tags/preview.md>), [production](<https://devfeed.tech/tags/production.md>), [threads](<https://devfeed.tech/tags/threads.md>), [unique](<https://devfeed.tech/tags/unique.md>)

### AI overview

Kotlin 1.5.30 introduces a preview of a new Kotlin/Native memory model, which the excerpt presents as a potential step toward wider adoption of Kotlin shared code. The current model has been a source of confusion and a barrier for some teams. The preview is described as permitting unrestricted shared access to state, though the author advises against production use for now and anticipates production deployments only as Kotlin 1.6 arrives. Questions remain about concurrency features comparable to JVM synchronization and how libraries requiring the new model will interact with code compiled under the existing freeze model. The excerpt says developers will still need to understand the current model for at least six months and that switching models may initially require little or no code change.

### Source excerpt

Kotlin 1.5.30 officially launched just now. There has been a steady stream of Kotlin releases over the last year or so, each with new features and fixes. In other words, business as usual. Since we (Touchlab) are plugging away, day in and out, working on client projects using KMM🐶, it can be easy to lose track of the bigger milestones. Kotlin 1.5.30 feels (numerically speaking) like just another point release, but this is a milestone advance for the platform. 1.5.30 presents a few big features, at least in preview, which will ultimately pave the way for "production ready" mainstream adoption of Kotlin shared code technology. Kotlin 1.5.30 is a turning point in KMP. Here's why.Memory Model Preview One of the most controversial aspects of Kotlin/Native is the concurrency and memory model. There are a lot of takes on it. Whether it was a good or bad thing, and why, is beyond the scope of today's post. However, I talked about it much more than anything else over the last few years because for KMM and KMP to grow, people would need to understand it. Still, it's been a significant blocker for some. That will be changing soon. I would not run the new memory model in production yet 🤞, but you can start experimenting with it now, and expect production deployments to pop up as we settle into 1.6 (I'm guessing :) 🚀. What is this memory model business you ask? Well, in some languages (Java, Swift, etc), multiple threads can read and write shared state. There are a number of ways in which that can be dangerous and error prone. Many languages don't let you access state from multiple threads (JS), some even have memory restriction rules built into the language and compiler (Rust). Kotlin/Native introduced a relatively unique model. In concept, it's interesting, but in practice, it can be confusing and a barrier to adoption. The new memory model will presumably allow unrestricted shared access to state. There are outstanding questions. Will there be equivalents to the JVM concurren

## Ktor and Kotlin/Native

DevFeed: [Ktor and Kotlin/Native](<https://devfeed.tech/articles/ktor-and-kotlin-native-25952.md>)

Original publisher: [Read original article](<https://medium.com/@kpgalligan/ktor-and-kotlin-native-fb5c06cb920a?source=rss-c2f810aa7890------2>)

Author: Kevin Galligan

Published: 2020-09-01T20:05:18Z

Content type: article

Language: en

Sources: [Kevin Galligan](<https://devfeed.tech/sources/stories-by-kevin-galligan-on-medium.md>)

Topics: [Ktor](<https://devfeed.tech/topics/ktor.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>)

Tags: [1-3](<https://devfeed.tech/tags/1-3.md>), [1-4](<https://devfeed.tech/tags/1-4.md>), [2019](<https://devfeed.tech/tags/2019.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [ios](<https://devfeed.tech/tags/ios.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [kotlin-native](<https://devfeed.tech/tags/kotlin-native.md>), [kotlinx](<https://devfeed.tech/tags/kotlinx.md>), [ktor](<https://devfeed.tech/tags/ktor.md>), [main-thread](<https://devfeed.tech/tags/main-thread.md>), [memory-model](<https://devfeed.tech/tags/memory-model.md>), [parallel](<https://devfeed.tech/tags/parallel.md>), [single-threaded](<https://devfeed.tech/tags/single-threaded.md>), [thread](<https://devfeed.tech/tags/thread.md>), [threads](<https://devfeed.tech/tags/threads.md>)

### AI overview

Ktor's Kotlin/Native behavior depends on the kotlinx.coroutines threading model. Initially, Kotlin/Native coroutines could suspend but could not schedule work across threads, so Ktor was designed for single-threaded use; the excerpt says iOS calls generally needed to start on the main thread. A multithreaded ("MT") branch later enabled cross-thread communication, with parallel releases cited as 1.3.9 and 1.3.9-native-mt. Before Ktor 1.4, using that MT version required keeping Ktor's scope on the main thread and unfrozen: changing a scope's dispatcher could freeze it and its Job-held objects, causing InvalidMutabilityException when background work shared that scope. The excerpt says the parallel release model was expected to continue until the Kotlin/Native memory model update, but it cuts off mid-explanation and does not establish later guidance or current status.

### Source excerpt

https://commons.wikimedia.org/wiki/File:Network-cables-1.png The story of coroutines for Kotlin/Native has been complex for a while now, and with the news that the Kotlin/Native memory model will be changing, coroutines for Kotlin/Native will remain a complex story for some time. Ktor is built around coroutines. The coroutines situation fundamentally affects how Ktor functions. There have been multiple moving targets in this story, which has created a lot of confusion and a number of bug reports that kind of cross over the same core issues. In this post, I will attempt to add some clarity to the situation. The Coroutines Situation To be clear, when we're talking about "coroutines", we're generally talking about kotlinx.coroutines. It's technically a separate library, but I can't imagine a realistic situation where you'd actually use coroutines and not include kotlinx.coroutines. Initially, kotlinx.coroutines for Kotlin/Native was single-threaded. You could suspend execution, but not schedule work on different threads. This was due to Kotlin/Native's memory model. Ktor was designed to run on this single-threaded model. Also, as far as I know on iOS, you would need to initiate Ktor calls from the main thread. In late 2019, a draft PR emerged which allowed kotlinx.coroutines to communicate across threads. We'll call this the "MT" branch, for "multithreaded". From this branch, there have been parallel library releases. The current main release is '1.3.9' and the current multithreaded release is '1.3.9-native-mt'. Unless something changes, the parallel branch and release model will likely stay the same for kotlinx.coroutines until the Kotlin/Native memory model update is complete. Ktor Until 1.4, Ktor was still designed to be run with the single-threaded version of kotlinx.coroutines. You *could* run it with the MT version, but you had to be very careful to keep the scope you were in to the main thread and make sure it was never frozen. It's a little complicated to expla