PROGMEM using more SRAM?

Why does commenting this line out (and replacing it with a hardcoded string where I reference it) use less sram?

const prog_char pmTable[] PROGMEM = "<table>";
const prog_char pmTable_[] PROGMEM = "</table>";
const prog_char pmTr[] PROGMEM = "<tr>";
const prog_char pmTr_[] PROGMEM = "</tr>";
const prog_char pmTd[] PROGMEM = "<td>";
const prog_char pmTd_[] PROGMEM = "</td>";
const prog_char pmBr[] PROGMEM = "
";
const prog_char pmSpantitle[] PROGMEM = "<span class=title>";
//const prog_char pmSpan_[] PROGMEM = "</span>";
const char* pHTMLTags[] PROGMEM = {pmTable, pmTable_, pmTr, pmTr_, pmTd, pmTd_, pmBr, pmSpantitle};//, pmSpan_};

This is the function I am using to obtain free sram.

int freeMemory()
{
  int free_memory;

  if((int)__brkval == 0)
    free_memory = ((int)&free_memory) - ((int)&__bss_end);
  else
    free_memory = ((int)&free_memory) - ((int)__brkval);

  return free_memory;
}

OK, sussed it.

I am losing the memory in this function that I wrote to get the values from PROGMEM, not the actual inclusion of PROGMEM.

Why would this not free up memory...

String htmlTag(const int& _Tag)
{
  char x[20];
  strcpy_P(x, (char*)pgm_read_word(&(pHTMLTags[_Tag])));
  String d (x);
  return d;
}

...(called like this)...

_HTTPClient.println(htmlTag(0));

...when this code does?

char x2[20];
strcpy_P(x, (char*)pgm_read_word(&(pHTMLTags[0])));
_HTTPClient.println(x);

Beakie:
OK, sussed it.

I am losing the memory in this function that I wrote to get the values from PROGMEM, not the actual inclusion of PROGMEM.

Why would this not free up memory...

String htmlTag(const int& _Tag)

{
 char x[20];
 strcpy_P(x, (char*)pgm_read_word(&(pHTMLTags[_Tag])));
 String d (x);
 return d;
}

The string you have named d is being returned by the function. Thus it has to make a copy of it (by doing a malloc in sthe String library). So the extra 20-odd bytes taken by the string are still being used (or the copy anyway). Why make a copy anyway? Just get the function to do the println, and skip sending copies of the string everywhere (like your idea which works).

Like I mentioned before, passing strings around by value is only going to give you problems. Nick's plan is the best, but if you have something ELSE going on other than just printing it, the thing to do here is pass in a buffer that you manage externally (or a reference to a string if you must), and have the function copy it down into that buffer.

e.g. something like

void htmlTag(const int& _Tag, char* buf, int len)
{
  strncpy_P(buf, (char*)pgm_read_word(&(pHTMLTags[_Tag])), len);
}

Oh and you don't have to pass around const int ref's. Int's are small enough to just pass them around as is.