SPI LCD 1.3 inch display

I need some help with the 1.3 inch LCD (ST7789) display please. The system crashes after writing an exact number of frames ( in my case about 9,300 frames of 5 lines of monochrome text). I tested it with the scrolling text example supplied in the library and the same thing happens except that it crashes after writing about 37,000 frames. Allowing for the difference in the number of characters in each frame it seems that the system crashes after writing an exact number of bits. The program terminates at line 341 of ST7789 init.py. This is the routine to reformat the data before sending to the display and I get the Python error message “free (): invalid pointer”. I have monitored CPU and GPU memory utilisation and there seems to be plenty of free memory. I have tried it on a Raspberry PI 2 and a brand new PI Zero with new copies of Debian Buster, PIL and the ST7789 library. Many thanks

Replying to my own query! I have found a solution by using the Adafruit generic display driver on GitHub (adafruit-circuitpython-rgb-display). I could not get this to work with GPIO but it works with the digitalio module using the code in the Adafruit examples but changing the GPIO pin numbers to the Pimoroni examples. So far, I have run my program for 24 hours and it has not crashed. A quick look suggests that the data conversion code in the Adafruit driver has been carried over to the Pimoroni driver so I can’t see why this doesn’t work.