question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

refCnt() is 1 but internally 2?

See original GitHub issue

I found a memory leak in my software and wanted to fix it. The problem is, that I’m not shure where the refCnt really is:

image

if i realease the byteBufMessage after adding the message to the list object, I get an error that the refcnt already is 0.

my inbound stack: SSLHandler -> Websocket -> Some custom handler my outbound stack MessageToMessageEncoder -> IdleStateHandler

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
konsultanercommented, Apr 30, 2019

@njhill Thank you very much. Its not trivial to have everything leak free. Helped me a lot!

0reactions
njhillcommented, Apr 29, 2019

@konsultaner the raw value of the internal refCnt field itself is not the actual ref count, as warned by the comment next to it:

// Value might not equal "real" reference count, all access should be via the updater

The mapping is described here: https://github.com/netty/netty/blob/4.1/common/src/main/java/io/netty/util/internal/ReferenceCountUpdater.java#L32-L34. So 2 here really means a ref count of 1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webflux - How to prevent an IllegalReferenceCountException ...
I am using the spring WebClient to make two calls in parallel. One of the call results is passed back as a ResponseEntity,...
Read more >
refcnt.h - Apple Open Source
Atomic internally uses C11 atomic * operations and requires no external synchronization, whereas the locked flavor * assumes the refcnt object is locked...
Read more >
ReferenceCountUpdater xref - Netty
15 */ 16 package io.netty.util.internal; 17 18 import static ... 0 : rawCnt >>> 1; 73 } 74 75 /** 76 * Like...
Read more >
io.netty.handler.codec.ByteToMessageDecoder - 即时通讯网
ChannelInputShutdownEvent; 26 import io.netty.util.internal. ... refCnt() > 1 || cumulation instanceof ReadOnlyByteBuf) { 83 // Expand cumulation (by ...
Read more >
edenhill/librdkafka - Gitter
%7|1459950863.869|DESTROY|rdkafka#consumer-2| Destroy internal ... %7|1459950863.878|X|rdkafka#consumer-2| :0/internal: refcnt 1, ops 0, outbuf 0, wait 0, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found