I have a PSoC5LP project (a scientific instrument measuring pH and temperature) that uses the U8Glib library to drive a oled screen. It uses newlib-nano (with the floating point formatting option. It uses snprintf liberally to format text to be used on the OLED. It also uses strcmp a few times to parse some of the commands coming from USB or BLE. The code seems to run fine most of the time and interfaces via UART with PRoC to do the USB stuff. So it is making liberal use of the heap memory, I suppose.
From time to time there seems to be a memory issue that is unpredictable- the pH and temperature values (both floats) stop reading correctly. The instrument continues to run with all of the interrupts acting properly as well as the communications via USB and UART/BLE. But the pH and temp values are no longer there. I have attached pictures of the display. Interestingly, there is not a consistent amount of time that leads to this issue- sometimes it runs fine for days, other times it fails within hours. I have both the stack and the heap set at 0x2000 (8kB) which should be plenty. I am baffled as to why this happens and why it is so unpredictable. My assumption is that it's a memory management issue.
Unfortunately this is a commercial project and I can't share the code. But has anyone had these kinds of issues and maybe have some insight? Could it be something to do with newlib nano? I have plenty of space in SRAM to not use the nano version. It is so sporadic that I don't even know how to debug the thing.
Thanks guys!
Jason