Open QM-lsq opened 2 months ago
Check if HEAP keeps getting smaller forever.
int counter = 0;
uint32_t heap_size_start = esp_get_free_heap_size();
uint32_t heap_size_min = heap_size_start;
int err_code;
static NetBuf_t* ftpClientData = NULL;
while(1) {
err_code = ftpClient->ftpClientAccess("hello.txt", FTP_CLIENT_FILE_WRITE, FTP_CLIENT_TEXT, ftpClientNetBuf, &ftpClientData);
ESP_LOGI(TAG, "err_code=%d", err_code);
uint32_t heap_size_current = esp_get_free_heap_size();
if (heap_size_min > heap_size_current) heap_size_min = heap_size_current;
counter++;
printf("%d %ld --> %ld\n", counter, heap_size_start, heap_size_min);
ftpClient->ftpClientClose(ftpClientData);
vTaskDelay(100);
}
In my environment(esp32), I settled on 190692.
2986 221020 --> 190692
This phenomenon is caused by the ESP-IDF background task.
ESP-IDF background tasks consume a certain amount of HEAP.
I am very happy to receive your reply, according to your method for testing, running a certain number of times, really stable, thank you very much
However, I have another question, when reading the file can be downloaded in sections? Or read a larger length at once, which currently looks like a maximum of 4096 bytes at a time。I look forward to hearing from you
This library always uses 4096 bytes of space.
https://github.com/nopnop2002/esp-idf-ftpClient/blob/master/components/ftpClient/FtpClient.c#L348
https://github.com/nopnop2002/esp-idf-ftpClient/blob/master/components/ftpClient/FtpClient.c#L501
https://github.com/nopnop2002/esp-idf-ftpClient/blob/master/components/ftpClient/FtpClient.c#L842
Yes, I found this length configuration on line 36 of the file FtpClient.h, but it's not practical to use ESP32 for a full file download if the file is over 1MB or larger。 Is there any other way besides extending the length range of this value?
it's not practical to use ESP32 for a full file download if the file is over 1MB or larger
That is correct.
Is there any other way besides extending the length range of this value?
there is no.
when reading the file can be downloaded in sections?
It may be useful to have such a feature.
Your PR or your new repository would be most welcome.
I hope that many people will add new features based on my repository.
Thank you very much for your reply
Excuse me,If I wanted to send some Command like STOR, Is it possible to just use the sendCommand interface?
STOR is ftpClientPut().
sendCommand() is a static function and cannot be used.
if I just want to send a STOR or a RETR Command, Which function can I use?
Which function can I use?
The available APIs are described in the README.
It is not possible to send only STOR or RETR commands.
Excuse me, when using ftpClientAccess for write access will occur memory leak, how to deal with it?