Re: How to avoid stack overflow problems

Hi,

I have a problem running an arduino sketch(see attachment) on Mega, using Timezone library
The problem seems to be trivial but still have no clue how to solve it.

I am using

setTime(compileTime() - 600 * 60); // executed from Sydney corr is UTC+10

and getting

setTime(compileTime() - 600 * 60); // executed from Sydney corr is UTC+10

^

Sketch uses 32628 bytes (12%) of program storage space. Maximum is 253952 bytes.
Global variables use 8051 bytes (98%) of dynamic memory, leaving 141 bytes for local variables. Maximum is 8192 bytes.
Low memory available, stability problems may occur.

Could please you help?

for_check.ino (33.6 KB)

600 * 60This isn't causing your memory problem, but will cause you some grief in the future.

I can't see your code, sorry.

You have an epic amount of static string data. Try keeping it out of RAM with the F macro:

  client.println(F("HTTP/1.1 200 OK"));

You have other static data that could be restricted to progmem q.v. too.

Excess global memory usage is not a stack overflow. Your stupidly massive amount of string literals is the more likely cause of the problem.