I need read many time this method from server. When I used it a noticed that my memory was losing.
Why it was happend?
Code: Select all
esp_http_client_handle_t client2 = esp_http_client_init(&config);
esp_http_client_set_method(client2, HTTP_METHOD_POST);
esp_http_client_set_header(client2, "Cookie", ssid);
err = 0;
err = esp_http_client_set_post_field((esp_http_client_handle_t) *client2, (const char *) param_send, size_send);
printf("POST nr %d ERR = %d \n",run_client, err);
check_ram();
if (heap_caps_get_free_size(MALLOC_CAP_8BIT)/1024 > 20)
{
printf("**Perrforming \n");
err = esp_http_client_perform((esp_http_client_handle_t) *client2);
}
else {
printf("**!NOT Perrforming \n");
}
Code: Select all
esp_http_client_config_t config = {
.host = ADRES_HOST,
.path = ADRES_PATH,
.port = ADRES_PORT,
.transport_type = HTTP_TRANSPORT_OVER_TCP,
.buffer_size = 4*1024,
.event_handler = _http_event_handler,
.is_async = false,
};
Code: Select all
I (8473) Check HEAP ... : free DRAM 151 kB 0x25ef8 | IRAM 209 kB 0x344a4
I (8493) Check HEAP ... : free DRAM 142 kB 0x23aac | IRAM 200 kB 0x32058
f(): http_snd_frame2
I (8503) Check HEAP ... : free DRAM 142 kB 0x23aac | IRAM 200 kB 0x32058
I (8513) Check HEAP ... : free DRAM 142 kB 0x23aac | IRAM 200 kB 0x32058
POST nr 1 ERR = 0
I (8513) Check HEAP ... : free DRAM 142 kB 0x23aac | IRAM 200 kB 0x32058
**Perrforming
f() test_task counter: 8
I (8783) Check HEAP ... : free DRAM 142 kB 0x238e8 | IRAM 199 kB 0x31e94
*CHECK TASK no: 1074322304 size: 448
I (8853) Check HEAP ... : free DRAM 37 kB 0x969c | IRAM 95 kB 0x17c48
*CHECK TASK no: 1074322304 size: 8144
I (8863) ~ 3927 ---> 3927
I (8873) Check HEAP ... : free DRAM 27 kB 0x6e98 | IRAM 85 kB 0x15444
I (8873) Check HEAP ... : free DRAM 32 kB 0x8268 | IRAM 90 kB 0x16814
*CHECK TASK no: 1074322304 size: 8144
-esp_http_client_is_chunked_response- 0
_TEST_ esp_http_client_is_chunked_response part_size 4096
I (8893) ~ 4096 ---> 8023
I (8903) Check HEAP ... : free DRAM 32 kB 0x8268 | IRAM 90 kB 0x16814
I (8913) Check HEAP ... : free DRAM 37 kB 0x9578 | IRAM 94 kB 0x17b24
*CHECK TASK no: 1074322304 size: 8144
-esp_http_client_is_chunked_response- 0
_TEST_ esp_http_client_is_chunked_response part_size 4096
I (8933) ~ 4096 ---> 12119
I (8933) Check HEAP ... : free DRAM 37 kB 0x9634 | IRAM 94 kB 0x17be0
I (8943) Check HEAP ... : free DRAM 42 kB 0xaa38 | IRAM 99 kB 0x18fe4
I think this is incorrect.
Next used this metod drop memory to 10kB or lower. Sometimes my wifi componets will crash.
This problem will no show if I didnt use .event_handler = _http_event_handler,
but I need this to operate on HTTP_EVENT_ON_HEADER: and HTTP_EVENT_ON_DATA:
If anyone what could I use incorect? Maybe something in according to connections aspects?