Kotlin 1.9.20 Improves Object Swarm Garbage Collection
Kotlin 1.9.20 garbage collects small objects faster than ever before
Kotlin 1.9.20 was released on November, 1, 2023. But let’s recap what’s new, because I didn’t cover that release:
- New default hierarchy template for setting up multiplatform projects
- Full support for the Gradle configuration cache in Kotlin Multiplatform
- Custom memory allocator enabled by default in Kotlin/Native
- New and renamed targets in Kotlin/Wasm
- Support for the WASI API in the standard library for Kotlin/Wasm
- Performance improvements for the garbage collector in Kotlin/Native
The last one is my favorite. It consists of two subchanges:
- Full parallel mark to reduce the pause time for the GC
- Tracking memory in big chunks to improve the allocation performance
The latter one is an interesting improvement. Because now Garbage Collector tracks areas instead of object. So if you have a lot of small objects in your app, the GC overheat will be reduced with Kotlin 1.9.20, because scheduler tracks areas of allocation rather than allocations for every single instance of an object created.
Worth mentioning it’s an improvement for Kotlin/Native.
Subscribe for more Kotlin and coding news and articles!