Random parts of code getting chopped off without error message

Hi there,

so I've been working on a project, where I trigger a relay with the Arduino Uno. For controls I use a web server running through the Ethernet Shield and there is also a simple display to show some info. In general it all works and the code I would like to run is about 24k in binary sketch size.

But I've noticed that as soon as I pass about 20k of binary sketch size, some parts of the code will not get executed by the Arduino. It's uploading without errors and the rest of the code works just fine. It's only some functions which seem not to run.
For debugging I took a perfectly working smaller sketch and increased the size by adding some client.println("...") statements until the problem occured. So I think I've pinned it down to the sketch size… or am I missing something?

What baffles me is that it says "binary sketch size 24k (of a maximum of 32k)" before uploading and does not complain at all. I know that a certain amount of memory is used for the bootloader, but that's only about 0.5k, right?
So what's happening in there, why won't some parts of the code execute?

I tried to get the size down, but I can't lose 4k without also losing the functionalities I want. And I thought I could go up to 32k… :~

If anyone got any idea how to solve this it would be great!


My wild guess: you're out of RAM.

Wild guessing is all we can do without code.

Are you just adding straight code or data as well?


Going by the description, yes, you're running short of RAM.
Start moving your strings into PROGMEM.

Start here

The wild guesses seem to have been right:

In the output for the website I had a lot of strings. Now I put them into the F() macro and it all works as expected…

Are you just adding straight code or data as well?

I had been adding output of strings. It all makes sense now.

Thanks a lot!