Memory question ?

I have a atmega 328 and have been trying to follow the guide to finding out how much ram is being used at any given time for debug purposes.However in the serial monitor im getting 1824 bytes with the char array declared and with it commented out which is very confusing.

Any ideas whats going on ?

Im using the libary from here and the example sketch from here:
http://playground.arduino.cc//Code/AvailableMemory

#include <MemoryFree.h>

// 14-bytes string
//char str[] = "Hello, world!";


void setup() {
    Serial.begin(115200);
}


void loop() {
    //Serial.println(str);

    Serial.print("freeMemory()=");
    Serial.println(freeMemory());

    delay(1000);
}

Cheers

The compiler discards it unless you actually use it in your program...?

T

fungus:
The compiler discards it unless you actually use it in your program...?

That would explain it.

fungus:
The compiler discards it unless you actually use it in your program...?

Actually it is the linker.
The compiler can know if it referenced in a single source module but only
the linker can know if it were to be referenced in some other module.

--- bill