B4R Question Program size increase with simple Log statement

janderkan

Well-Known Member
Licensed User
Longtime User
Hi

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.
B4X:
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
BUT
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.

Jan


https://www.b4x.com/android/forum/threads/esp8266-stops-running.74080/#post-470488
https://www.b4x.com/android/forum/threads/esp8266-timer-stops-after-75-minutes.69700/#content
 

Attachments

  • Test.zip
    2.4 KB · Views: 351

Daestrum

Expert
Licensed User
Longtime 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

janderkan

Well-Known Member
Licensed User
Longtime User
You can make a test and call ::Serial.println with inline C code.
Will this also remove the error when timer stops after a while ?
I only use Log(" ") in the timer event because you said it was neccesary.
 
Upvote 0
Top