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

Derive direct memory used count from netty counter #223

Merged
merged 2 commits into from
Feb 18, 2017

Conversation

rdhabalia
Copy link
Contributor

Motivation

As mentioned at #222 : JvmMetrics doesn't return correct jvm_direct_memory_used

Modifications

Get the directMemoryUsed count from Netty-PlatformDependent counter.

Result

JvmMetrics provides correct directMemoryUsed metric.

@rdhabalia rdhabalia added the type/bug The PR fixed a bug or issue reported a bug label Feb 18, 2017
@rdhabalia rdhabalia added this to the 1.17 milestone Feb 18, 2017
@rdhabalia rdhabalia self-assigned this Feb 18, 2017
private static Field directMemoryUsage = null;
static {
try {
directMemoryUsage = PlatformDependent.class.getDeclaredField("DIRECT_MEMORY_COUNTER");
Copy link
Contributor

Choose a reason for hiding this comment

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

Since it's called a counter.. does it go down when the memory is released? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, updated test-case with the release call.

Copy link
Contributor

@merlimat merlimat left a comment

Choose a reason for hiding this comment

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

👍

@saandrews
Copy link
Contributor

Can we patch 1.16 as well?
👍

@merlimat merlimat merged commit b6f061a into apache:master Feb 18, 2017
rdhabalia added a commit to rdhabalia/pulsar that referenced this pull request Feb 21, 2017
* Derive direct memory used count from netty counter

* Fix: avoid initial direct-memory assertion with 0
@rdhabalia
Copy link
Contributor Author

Can we patch 1.16 as well?

yes.

rdhabalia added a commit that referenced this pull request Feb 21, 2017
* Derive direct memory used count from netty counter

* Fix: avoid initial direct-memory assertion with 0
@rdhabalia rdhabalia deleted the direct_mem branch June 21, 2017 18:55
sijie pushed a commit to sijie/pulsar that referenced this pull request Mar 4, 2018
hangc0276 pushed a commit to hangc0276/pulsar that referenced this pull request May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants