-
Notifications
You must be signed in to change notification settings - Fork 51
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
Add information about the need to release netty's buffers after message processing in WebSocket #112
Comments
Can you point out the example code which has the problem and provide a gist of the fix? |
So what I am reading is that the change would look like this in a typical socko app simbo1905/sprint-planning@6faec3f Do we have to leave it down to the person writing the app to remember to call release? Would it not be better and safer for socko to always call release after it has run the application supplied code? |
@simbo1905 Yep, that's what it looks like. However, some applications may want to pass buffers internally: say, to other actors. So if Socko suddenly start releasing buffer, it will be very surprising backward-incompatible change - apps will either crash or get wrong data because the buffer they try to access is already recycled. |
@yeputons okay but the vanilla use case is to parse the buffer into some app immutable type then pass on the app type for processing freeing the buffer. handing the release for the vanilla use case is error prone as exceptions may be thrown. how about this version which has a |
Say, websocker example does not call
frame.frame.release()
after it finishes processing, which results in memory leak. You can read more about reference-counted objects in Netty here.One possible way to check that you have no easy-detectable memory leaks is to run the application with
-Dio.netty.leakDetectionLevel=paranoid
, run garbage collector a lot withSystem.gc()
and look for errors in logs.The text was updated successfully, but these errors were encountered: