Arduino freezing with OLED display
Because your program uses various String objects in several different sizes, there's a good chance that heap memory (in RAM) is getting fragmented to the point that String allocation begins to fail, or begins to allocate on top of stack variables.  (Typically, heap and stack work toward each other, from opposite ends of memory that is free after static variables are allocated.)

For example, the code for(int y=1; y&lt;=x; y++){ dashes += "-"; } with x=6 creates half a dozen String objects, all of different lengths.

To avoid this problem, you could carefully release each heap allocated object when done with it, or more effectively, could avoid using String objects, which actually aren't needed in this program. 

For example, instead of display.println(String(previousMillis/1000)); say display.println(previousMillis/1000); and instead of building dashes a character at a time before using it, just say "------" in place of dashes.