Skip to content

Avoid unintended garbage collection of raw data in PreparedDictionaryImpl#190

Merged
hyperxpro merged 3 commits into
hyperxpro:mainfrom
bwollmer:preparedDictionaryFix
Nov 27, 2024
Merged

Avoid unintended garbage collection of raw data in PreparedDictionaryImpl#190
hyperxpro merged 3 commits into
hyperxpro:mainfrom
bwollmer:preparedDictionaryFix

Conversation

@bwollmer

Copy link
Copy Markdown
Contributor

Motivation:

As described in #189 the garbage collection currently removes the data from the dictionary, resulting in poor compression ratios, since no dictionary was actually used.
The code to finalize the rawData already exists.

Modification:
Hold the reference on rawData in PreparedDictionaryImpl

Result:
Fixes #189.

hyperxpro
hyperxpro previously approved these changes Nov 26, 2024

@hyperxpro hyperxpro left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@hyperxpro

Copy link
Copy Markdown
Owner

Can you add a test case as well? I know this is complicated but you can create GC pressure to trigger GC collection.

@bwollmer

Copy link
Copy Markdown
Contributor Author

Good point! The GC pressure seems to do the trick for the test. It consistently fails on the old code but works on the updated code.

@hyperxpro hyperxpro changed the title Avoid unintend garbage collection of raw data in PreparedDictionaryImpl Avoid unintended garbage collection of raw data in PreparedDictionaryImpl Nov 27, 2024
@hyperxpro hyperxpro merged commit f280107 into hyperxpro:main Nov 27, 2024
@hyperxpro

Copy link
Copy Markdown
Owner

Thanks a lot! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] PreparedDictionaryImpl data gets removed by garbage collection

2 participants