PROGMEM usage

Hi!
I've serched a bit before posting, but i've not found a definitive answer...
I'm writing a webserver page that have a lot of pages and strings, and i'm trying to find all the ways to save some memory.
So, i've came across the PROGMEM and F(), from what i've undertood this functions must use the data in flash, reading it at runtime (with a bit of slowness due to the slow reading performance of flash), but the arduino reference site:

tells that:

Store data in flash (program) memory instead of SRAM.

What that mean? At the time of compile the strings are already in flash, and at code execution are loaded into ram. PROGMEM and F() must avoid the load to SRAM phase, not Storing it to flash, as it's a thing that is already in flash.

Or i'm missing something?

Often, if you have a lot of HTML, you can do it like this and put it in flash memory in such a way that it does not all have to be in RAM at the same time. This uses PROGMEM and the C++11 raw string literal format.

const char MAIN_page[] PROGMEM = R"=====(
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        body {
            font-family: helvetica, arial, sans-serif;
        }

        table {
            border-collapse: collapse;
            border: 1px solid black;
        }

        /*table {border: 1px solid black;}*/

        td {
            padding: 0.25em;
        }

. . . .
. . . .

</body>
</html>

)=====";

Then you can send it like this:

server.send_P(200, "text/html", MAIN_page );

It's not loaded in SRAM at runtime. You read it directly from flash memory when you need it

It means it leaves the data in flash memory, and it doesn't get copied to RAM during crt0

Perfect! Thanks!