Inkplate downloadFile crashes with Guru Meditation error after ~3GB downloaded

Customer:

I want to download 8 750kB files and found that my sketch crashes with a Guru Meditation error once about 4 files have been uploaded in a loop. The sketch will download 12 x 256 kB before crashing or 4 x 768 kB. I seem to be hitting some sort of issue after downloading a total of around 3GB. Is there a pointer refresh issue or similar with the downloadFile command?

Attachment omitted in migration: downloadFile_test.ino

Originally submitted via the contact form on soldered.com on 23 May 2025. Migrated to the forum for community visibility.

Soldered Support:

The problem is due to the buffer_ptr pointer not being deallocated. Because of that the ESP tries to allocate more and more memory until you get the Guru Meditation error due to trying to access restricted memory. You can deallocate the memory by calling the free(buffer_ptr) function after the file.close() call. After doing that you can successfully download 20 768kB files as well as 20 256kB files.