Suspicious Memory leak when using esp-mqtt
Posted: Tue Jan 22, 2019 9:51 pm
Hello,
I tries to make a small Home Automation project with a Nextion display. I use Eclipse and C++ with the ESP-IDF together.
I made the first single test with the following code:
This is called via following way:
I checked the log file and for me seems a continusly decreasing trend....
Started:
I (12367) NextionMQTTBridge: [APP] Free memory: 213752 bytes
I (2477367) NextionMQTTBridge: [APP] Free memory: 213248 bytes
Where I made the mistake? Thank you very much in advance!
I tries to make a small Home Automation project with a Nextion display. I use Eclipse and C++ with the ESP-IDF together.
I made the first single test with the following code:
Code: Select all
void mqtt_app_start(void * parameters)
{
esp_mqtt_client_config_t mqtt_cfg = {
.event_handle = mqtt_event_handler,
.host = "192.168.1.140",
.uri = "mqtt://192.168.1.140:1883",
.port = 1883,
.client_id = "NextionMQTTBridge",
.username = mqtt_user,
.password = mqtt_password,
};
ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
esp_mqtt_client_handle_t client = esp_mqtt_client_init(&mqtt_cfg);
xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, false,true, 5000 / portTICK_PERIOD_MS);
esp_mqtt_client_start(client);
while(1){
vTaskDelay(5000 / portTICK_PERIOD_MS);
xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, false,true, 5000 / portTICK_PERIOD_MS);
esp_mqtt_client_publish(client,"test/NextionMQTTBridge","Hello World",10,0,0);
ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
}
vTaskDelete(NULL);
}
Code: Select all
void app_main(void) {
nvs_flash_init();
wifi_init();
xTaskCreate(&mqtt_app_start, "MQTT", 2000,NULL,5,NULL );
while(1) {
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
Started:
I (12367) NextionMQTTBridge: [APP] Free memory: 213752 bytes
I (2477367) NextionMQTTBridge: [APP] Free memory: 213248 bytes
Where I made the mistake? Thank you very much in advance!