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

Use PlatformDependent.threadLocalRandom() to reduce memory footprint #13977

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

jchrys
Copy link
Contributor

@jchrys jchrys commented Apr 15, 2024

Motivation:
Direct use of io.netty.util.internal.ThreadLocalRandom and j.u.c.ThreadLocalRandom could cause a lot of memory waste.

Modifications:
Use PlatformDependent.threadLocalRandom().

Result:
Reduced Memory footprint.

@jchrys jchrys changed the title Use PlatformDependent.threadLocalRandom() Use PlatformDependent.threadLocalRandom() to reduce memory footprint Apr 15, 2024
Motivation:
Direct use of `io.netty.util.internal.ThreadLocalRandom` and `j.u.c.ThreadLocalRandom` could cause a lot of memory waste.

Modifications:
Use `PlatformDependent.threadLocalRandom()`.

Result:
Reduced Memory footprint.
Copy link
Contributor

@chrisvest chrisvest left a comment

Choose a reason for hiding this comment

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

Only a problem on Java 7, which I don't think anybody is using anymore, but sure.

This does not need to be forward ported, because main does not have PlatformDependent.threadLocalRandom().

@jchrys
Copy link
Contributor Author

jchrys commented Apr 15, 2024

Only a problem on Java 7, which I don't think anybody is using anymore, but sure.

This does not need to be forward ported, because main does not have PlatformDependent.threadLocalRandom().

I thought this patch would affect java >= 7, Since it used io.netty.util.internal.ThreadLocalRandom, which should be used when java <= 6.

@normanmaurer normanmaurer added this to the 4.1.109.Final milestone Apr 15, 2024
@normanmaurer normanmaurer merged commit 0e436dd into netty:4.1 Apr 15, 2024
14 checks passed
@normanmaurer
Copy link
Member

@jchrys thanks

@jchrys jchrys deleted the 4.1-threadlocal-memory branch April 15, 2024 06:34
@chrisvest
Copy link
Contributor

I thought this patch would affect java >= 7, Since it used io.netty.util.internal.ThreadLocalRandom, which should be used when java <= 6.

You're correct. I misread it.

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.

None yet

4 participants