-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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 leak with esp_http_client + CONFIG_MBEDTLS_DYNAMIC_BUFFER (IDFGH-4251) #6104
Comments
Thanks for reporting, we will look into. |
FYI, there is a fix in ESP8266_RTOS_SDK: This fix can be applied to esp-idf, you can check if it helps. |
@AxelLin |
BTW, here is another fix you might want to apply if you set CONFIG_MBEDTLS_DYNAMIC_FREE_PEER_CERT=y. |
…drop earlier RX process caches the session information in "ssl->in_ctr" not in "ssl->in_buf". So when freeing the SSL, can't free the "ssl->in_ctr", because the "ssl->in_buf" is empty. Make the RX process like TX process, and cache the session information in "ssl->in_buf", so that the cache buffer can be freed when freeing the SSL. Closes #6104
Environment
Problem Description
A small amount of memory (~16b) is leaked with each HTTPS connection using esp_https_client with CONFIG_MBEDTLS_DYNAMIC_BUFFER enabled.
No memory is leaked if CONFIG_MBEDTLS_DYNAMIC_BUFFER is disabled.
Heap trace suggests this is due to LwIP making a series of 4b allocations but I'm having trouble debugging further.
Steps to reproduce
Using esp_http_client_example as a base, replace http_test_task function with the following:
Enable CONFIG_MBEDTLS_DYNAMIC_BUFFER
Debug Logs
CONFIG_MBEDTLS_DYNAMIC_BUFFER Disabled (no leak?)
CONFIG_MBEDTLS_DYNAMIC_BUFFER Enabled (~16b avg leak)
The text was updated successfully, but these errors were encountered: