|
UPDATED: Final adjustments, thanks to everyone who have commented
This had been done on BattleOS base, if you're using a different base, make it match to yours, wherever your packet is being handled at, must call this AFTER packet has completely being used.
@IncomingPacketHandlerRegistration#dispatchToHandl er:
Replace with:
Code:listener.ifPresent(msg -> { try { msg.handlePacket(player, packet); } finally { ReferenceCountUtil.release(packet); } });
For more explanation visit:
Netty.docs: Reference counted objects
Netty version tested on: Netty.4.1.9-Final
Note:
- This has been detected on ResourceLeakDetector=Paranoid
- This might be also useful for those who use this netty release on their server and have this occurring
- This might work on different netty versionshttps://www.rune-server.ee/runescape...ml#post5378127
Hmm never knew about that.. Thanks for the heads up
Yeah thats true, good comparision to do with a database connection too and specially the 'resultset' which most people does not close which later on can cause a memleak.
But.. it could also be interesting to find out which packet is not being fully read if thats the case..
Thanks for this, will look more into this myself. Keep us updated on anything else related to this stuff.
Update:
A small issue I've witnessed how the #release() call may not complete, hence, having something like this may sort of solute the issue:
However I have not tested this way, so something you might want to test by your own. let me know how it goes though.Code:@Override public void finalize() throws Throwable { while (!payload.release()) super.finalize(); }
Last edited by Gnakos; 05-13-2017 at 03:24 PM. Reason: Didnt knew try finally worked only try catch finally
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |