Memory overflow error


What causes memory overflow error? I could not understand it very well from the material I read and watched from internet. Could it be sourced from kind of a bug? Where can I find a useful material on why is it caused?
I was trying to design a Nextion project for a company, which is going to require 20 pages. I am not sure that I am allowed to share details about it. Yesterday I compiled and uploaded the project and it was working quite fine. Today I designed a page which takes arguments from one page and saves them to a text file, later allowing them to be used in other pages. When I tried to debug the code. All 20 pages gave the error of memory overflow. I could not understand what I did wrong. I would love to have your help. Thank you.

Hi @ulasus23,

I have a suspicion where your issue’s coming from…
All the green attributes of components are stored in the RAM - which for most devices is limited to 3584 bytes. A common reason for users to run out of RAM is that they make too many components global. While making them global is the easiest way to make their properties persistent (f.ex. remember the value when switching between pages), it is also extremely RAM consuming because all of the components attributes become global.
In case you wondered, global variables/attributes are always kept within those 3584 bytes of RAM, while local variables/attributes are only loaded into the RAM when their page is active.

It is particularly annoying that the built-in keyboard makes people believe that making components global was a good idea or the way to go.

I’ve detailed this topic in another post and also cover a few possible solutions: Need to keep page load in preinitlaization while values update from arduino - #7 by Max

Kind regards,


Thank you. That was exactly what I did in that page. I added at least 40 global scope components, in order to extract their info to other pages. I will check your post and look for a solution.

1 Like

Controls use the most global memory. I’ve found that it’s most efficient to declare a simple variable for the controls value and make it global. Other pages can modify it and you use it to update the control in the Pre-Initialize Event when you return to that page.

That (and more) is exactly what I describe in the posts linked above :smile: