Skip to content
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

memory leaks for windows #3182

Open
ManojKumarChauhan opened this issue Jul 10, 2024 · 0 comments
Open

memory leaks for windows #3182

ManojKumarChauhan opened this issue Jul 10, 2024 · 0 comments

Comments

@ManojKumarChauhan
Copy link

While using libwebsocket for windows, I noticed there are some memory leaks for following cases.

Case 1: memory leak when destroy context (call lws_context_destroy)
If we call lws_context_destroy then it doesn't free the context because of following condition which is true.
pt->inside_lws_service

But in case of unix, it destroys the context in _lws_plat_service_tsi. Following code do that:
if (pt->destroy_self) {
lws_context_destroy(pt->context);
return -1;
}

This code was committed in 2020.
commit 271ca83
Author: Andy Green andy@warmcat.com
Date: Thu Jan 23 11:12:28 2020 +0000

When I tried the same code for windows, memory leak issue got fixed.
Can I use this same code & is it confirm that it will not make any impact?
OR am I using libwebsocket in wrong way & don't need to use this code?
Please suggest.

  1. While sending/receiving data we call lws_service & send/receive data in our callback which is called by websocket. I found memory is also increasing while using lws_service. We are allocating memory in _lws_change_pollfd & destroy this only when the context is deleted. Should I call any other function to free the memory allocated by lws_service?
    To send any data I call lws_callback_on_writable before lws_service.

Please suggest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant