-
Notifications
You must be signed in to change notification settings - Fork 349
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
change receivers to share_ptr #203
base: master
Are you sure you want to change the base?
Conversation
change receivers to share_ptr
Hi @sicxs just wondering the reason for using shared_ptr here? The |
I opted for the lightweight pointer approach here since the socket adapter is a single threaded event loop listener |
When the server runs, everything is normal. |
Would an alternate solution here be to call remove all listeners internally
inside server close method? I'm aiming for optimal performance and would
like to resolve this without bringing in shared ptr if possible.
…On 28 November 2017 at 02:12, sicxs ***@***.***> wrote:
When the server runs, everything is normal.
When the server is closed, if the removeReceiver is not called, it will
lead to a memory leak.
But when the server is off, I also need to listen to the onSocketClose
event, do the memory release, and not call the removeReceiver
This creates a contradiction. If shared_ptr is used, I don't need to call
removeReceiver when the server is closed
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#203 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGKDBdmdobtwzaB7RUF8kCsIGcaodUqks5s613wgaJpZM4QrRZg>
.
|
Please solve the problem of memory leakage |
I fixed it in this way and no memory leak:
|
change receivers to share_ptr