5.5.4 How Can I Reduce RAM Usage?

Try the following suggestions to reduce RAM usage:

  1. Some of the same suggestions for making your code smaller can be useful to reduce RAM usage, see the following section of this user’s guide:

    How Can I Make My Code Smaller?

  2. Rather than pass large objects to (or from) functions, pass pointers that reference these objects (to save stack resources).
  3. Objects that do not need to change throughout the program can be located in program memory using the -mconst-in-code option and the const qualifier. This frees up precious RAM, but slows execution. Refer to the following section of this user’s guide:

    Variables in Program Space