SD Card Libray & Memory Optimization

Hi, When i Tried to include SD card library in my sketch it is showing a warning "Low memory available, stability problems may occur."

If library is not included dynamic memory usage is 46% i.e 942 bytes

With library , dynamic memory usage is 75% i.e 1538 bytes

  1. Is there anyway i can optimize my code without library ( It is bit messy.. all suggestions are welcomed)
  2. SD Library alone taking 41% of dynamic memory i.e 839 bytes , are there any alternatives with less memory usage ?

using Mega isn't a option for me since i bought the shield for UNO and iam not sure it is compatible with MEGA.

Find the code as attachment. i'm unable to post the code due to character limit

trackerpro.ino (9.03 KB)

Is there anyway i can optimize my code

Yes. Quit pissing away resources using the String class. Learn to use C-style string (NULL terminated arrays of chars).

Use the F() macro to keep string literals out of SRAM.

PaulS:
Use the F() macro to keep string literals out of SRAM.

Is function overloading good idea to implement this ?

        sendBLEDebugMessage("Lng \t");
        sendBLEDebugMessage(longitude);

I dont think F() Macro allow variables

Is function overloading good idea to implement this ?

Yes.

I dont think F() Macro allow variables

If you try to keep the "variable" out of SRAM, then it isn't a variable, is it?

PaulS:
If you try to keep the "variable" out of SRAM, then it isn't a variable, is it?

by using PROGMEM ?

anilkunchalaece:
by using PROGMEM ?

What do you know about PROGMEM? Do you KNOW that it is read-only?

Do you think you can change the value of a read-only "variable"? If you can't make the value vary, it isn't a variable, is it?