-
Notifications
You must be signed in to change notification settings - Fork 620
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
Fix memory leak caused by invalid KTypeWrapper's equals method #2274
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jooohn
changed the title
Fix memory leak caused by invalid KTypeWrapper equality
Fix memory leak caused by invalid KTypeWrapper equals method
Apr 16, 2023
jooohn
changed the title
Fix memory leak caused by invalid KTypeWrapper equals method
Fix memory leak caused by invalid KTypeWrapper's equals method
Apr 16, 2023
shanshin
approved these changes
Apr 17, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job, thank you for the investigation!
xBaank
pushed a commit
to xBaank/kotlinx.serialization
that referenced
this pull request
Apr 20, 2023
…n#2274) * Fix KTypeWrapper equality bug to avoid memory leak * Optimize imports of CachingTest.kt
xBaank
added a commit
to xBaank/kotlinx.serialization
that referenced
this pull request
Apr 20, 2023
Kotlin#2274)" This reverts commit 836f2bd.
xBaank
added a commit
to xBaank/kotlinx.serialization
that referenced
this pull request
Apr 20, 2023
* Revert "Adapt tests for K2 and upcoming deprecations in K1 (Kotlin#2230)" This reverts commit f9229ef. * Revert "Fix value class encoding in various corner cases (Kotlin#2242)" This reverts commit 3cec2f7. * Revert "Improved docs for JsonContentPolymorphicSerializer (Kotlin#2189)" This reverts commit 3555872. * Revert "Fix incorrect json decoding iterator's .hasNext() behavior on array-wrapped inputs: (Kotlin#2268)" This reverts commit 2864aea. * Revert "Fix memory leak caused by invalid KTypeWrapper's equals method (Kotlin#2274)" This reverts commit 836f2bd. * Revert "Replace deprecated ThreadLocal with kotlin.native.concurrent.ThreadLocal (Kotlin#2266)" This reverts commit d73f6e3. * Revert "Get rid of deprecated toChar() in JS-specific code (Kotlin#2252)" This reverts commit 3686362. * Revert "Rename json-okio `target` variables to `sink` (Kotlin#2226)" This reverts commit a978cf0. * Revert "Replace `runCatching-map-getOrDefault` in caching (Kotlin#2248)" This reverts commit da91066. * Revert "Configure project settings for Intellij IDEA (Kotlin#2217)" This reverts commit d519d45. * Revert "Updated K/N targets in accordance with official recommendations (Kotlin#2216)" This reverts commit fe63ced.
bcmedeiros
added a commit
to bcmedeiros/ktor
that referenced
this pull request
May 12, 2023
This gets all the bug fixes in https://github.com/Kotlin/kotlinx.serialization/releases/tag/v1.5.1, and Kotlin/kotlinx.serialization#2274 can heavily affect ktor users.
bcmedeiros
added a commit
to bcmedeiros/ktor
that referenced
this pull request
May 12, 2023
This gets all the bug fixes in https://github.com/Kotlin/kotlinx.serialization/releases/tag/v1.5.1, and Kotlin/kotlinx.serialization#2274 can heavily affect ktor users.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
KTypeWrapper
'sequals
method was not implemented correctly.This bug causes a cache miss every time here, which leads to a memory leak by registering a new serialiser every time it is looked up.
This also leads to performance degradation, since the equality check is performed linearly against each registered object that always has the same hashCode.