Thread: [Netty] Memory (ByteBuf) leak fix

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 25
  1. #11  
    Super Donator


    Join Date
    Feb 2011
    Age
    27
    Posts
    1,126
    Thanks given
    180
    Thanks received
    178
    Rep Power
    243
    Quote Originally Posted by Tyrant View Post
    Absolutely, however I have not wrapped it with try-finally, it does seem to solute that issue though.
    Could you maybe get back regarding if that solution did resolve the whole issue without a throwable fix..?
    Reply With Quote  
     

  2. #12  
    Software Developer

    Tyrant's Avatar
    Join Date
    Jul 2013
    Age
    24
    Posts
    1,562
    Thanks given
    678
    Thanks received
    423
    Rep Power
    1060
    Quote Originally Posted by Gnakos View Post
    Could you maybe get back regarding if that solution did resolve the whole issue without a throwable fix..?
    I did digged the subject a bit more, it does seems like that the fix I provided is working properly, I have done a stress test of sending many different packets at many different sizes, with different
    bytes structures and they were all being handled just fine, aswell as no any memory leak issue occurring.
    Reply With Quote  
     

  3. #13  
    Super Donator


    Join Date
    Feb 2011
    Age
    27
    Posts
    1,126
    Thanks given
    180
    Thanks received
    178
    Rep Power
    243
    Quote Originally Posted by Tyrant View Post
    I did digged the subject a bit more, it does seems like that the fix I provided is working properly, I have done a stress test of sending many different packets at many different sizes, with different
    bytes structures and they were all being handled just fine, aswell as no any memory leak issue occurring.
    Hmm okey, but feels a bit cheapy todo that way by using the super() .. Feels more nifty to use a try catch=>finally but hey that can be me , so thats the only reason I asked if you could test it
    Reply With Quote  
     

  4. #14  
    Software Developer

    Tyrant's Avatar
    Join Date
    Jul 2013
    Age
    24
    Posts
    1,562
    Thanks given
    678
    Thanks received
    423
    Rep Power
    1060
    Quote Originally Posted by Gnakos View Post
    Hmm okey, but feels a bit cheapy todo that way by using the super() .. Feels more nifty to use a try catch=>finally but hey that can be me , so thats the only reason I asked if you could test it
    Does pretty much the same work except in my method it will try to finalize it till it has been released, whatever works for you though
    EDIT: My bad, I read you wrong, it does seems like that so try - finally might actually be the solution
    Reply With Quote  
     

  5. #15  
    Super Donator


    Join Date
    Feb 2011
    Age
    27
    Posts
    1,126
    Thanks given
    180
    Thanks received
    178
    Rep Power
    243
    Quote Originally Posted by Tyrant View Post
    Does pretty much the same work except in my method it will try to finalize it till it has been released, whatever works for you though
    Hmm yeah, just feels a bit weird to do a while loop till its finalized instead of just using a try=>finally ; but yeah both works then, good to know
    Reply With Quote  
     

  6. #16  
    Registered Member
    hc747's Avatar
    Join Date
    Dec 2013
    Age
    26
    Posts
    1,474
    Thanks given
    3,312
    Thanks received
    691
    Rep Power
    1098
    Why not just
    Code:
    try {
    ...
    } finally {
    ReferenceCountUtil.release(packet);
    }
    Reply With Quote  
     

  7. #17  
    Software Developer

    Tyrant's Avatar
    Join Date
    Jul 2013
    Age
    24
    Posts
    1,562
    Thanks given
    678
    Thanks received
    423
    Rep Power
    1060
    Quote Originally Posted by hc747 View Post
    Why not just
    Code:
    try {
    ...
    } finally {
    ReferenceCountUtil.release(packet);
    }
    There's no difference, although this is how I was originally going to post this, I've encountered an issue that sometimes release wont be completed... I do think using try-final is ideal tho
    Reply With Quote  
     

  8. #18  
    Renown Programmer & Respected Member

    Ryley's Avatar
    Join Date
    Aug 2011
    Posts
    596
    Thanks given
    254
    Thanks received
    521
    Rep Power
    1332
    Quote Originally Posted by Tyrant View Post
    There's no difference, although this is how I was originally going to post this, I've encountered an issue that sometimes release wont be completed... I do think using try-final is ideal tho
    There is a difference. That is precisely how I fixed this issue in Apollo many moons ago.

    https://github.com/apollo-rsps/apoll...dler.java#L103
    Reply With Quote  
     

  9. Thankful user:


  10. #19  
    Super Donator


    Join Date
    Feb 2011
    Age
    27
    Posts
    1,126
    Thanks given
    180
    Thanks received
    178
    Rep Power
    243
    Quote Originally Posted by Ryley View Post
    There is a difference. That is precisely how I fixed this issue in Apollo many moons ago.

    https://github.com/apollo-rsps/apoll...dler.java#L103
    May I just ask.. is there any difference between using

    Code:
    ReferenceCountUtil.release(message);
    and
    Code:
    message.release(); // Which is the way Netty docs does
    Reply With Quote  
     

  11. #20  
    Renown Programmer & Respected Member

    Ryley's Avatar
    Join Date
    Aug 2011
    Posts
    596
    Thanks given
    254
    Thanks received
    521
    Rep Power
    1332
    Quote Originally Posted by Gnakos View Post
    May I just ask.. is there any difference between using

    Code:
    ReferenceCountUtil.release(message);
    and
    Code:
    message.release(); // Which is the way Netty docs does
    Yes. Using the ReferenceCountUtil.release is for objects that do not implement ReferenceCounted (thus do not have a release() method)

    From Netty Wiki:
    Note that ByteBuf isn't the only reference-counted type in Netty. If you are dealing with the messages generated by decoders, it is very likely that the message is also reference-counted
    Read: Netty.docs: Reference counted objects
    Reply With Quote  
     

  12. Thankful user:


Page 2 of 3 FirstFirst 123 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [Battle-OS] Player appearance updating fix
    By Tyrant in forum Snippets
    Replies: 7
    Last Post: 05-19-2017, 08:04 PM
  2. Replies: 15
    Last Post: 04-19-2014, 02:36 PM
  3. Memory leak, paying for fix!
    By Russ in forum Help
    Replies: 5
    Last Post: 03-07-2011, 07:26 PM
  4. [PI] Memory Leak... $45 For Fix! [PI]
    By `Eclipse™ in forum Help
    Replies: 2
    Last Post: 02-12-2011, 11:17 AM
  5. [Delta] memory leak 10$ FOR FIX
    By Neekage in forum Help
    Replies: 7
    Last Post: 09-08-2010, 01:21 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •