B4R Question Program size increase with simple Log statement


Active Member
Licensed User

I have a test program using AtMega328 (Uno) with 5 Timers.
The 5 timers is in 5 code modules and initialized from AppStart. (Zip attached)
Due to the problem with timers stopping after a while, I have added a conditional Log statement in each timer event in production mode.
Log(" ")
The size of the program without Log statement is 5976 bytes.
In production mode with Log statements the size is 6286 bytes.

This test program does nothing
With my real project the size without Log statements is 26686 bytes and 28616 bytes with Log statements.

Both programs have 5 modules, 5 timers and 5 Log statements.
The only thing I change is adding or removing the 5 Log Statements.

Can anyone explain why the same 5 statements use 310 bytes in one program and 1930 bytes in another ?

Would i benefit of having only 1 timer in Main module that calls the subs in each module ?

This is realy important to me because I soon hit the ceiling.




  • Test.zip
    2.4 KB · Views: 53


Well-Known Member
Licensed User
Maybe try putting the log routine in a sub in main module, that way it will be smaller as it won't be duplicating the logging code for each module, and a call to it will be tiny too.
Upvote 0