henryhanselscott
Posts: 107
Joined: Sun Jan 18, 2015 1:31 pm

ready access memory retention?

Mon Oct 05, 2015 9:24 am

So at the risk of sounding like an idiot, here goes:

I have a Python3 script that reads a file on start up, assigns a variable the text data in the file and then closes the file. The script may run for weeks or even months. Is there any risk that the OS will dump or overwrite this area of memory or that it will become corrupt over time. My script may not read the variable again for a LONG time, but when it does it has to be correct. I have seen no indication that it is losing the data, but I have not tested it out over "months" of time either.

Rpi2/Raspbian/Standard clock speed

Thanks,
Henry

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: Korea

Re: ready access memory retention?

Mon Oct 05, 2015 9:59 am

The OS won't overwrite or lose it, but there is a tiny possibility it might be zapped by cosmic rays, which may alter the value.

It's unlikely, but if you are worried why not read the data from the file when it's time to make the comparison?

Heater
Posts: 14443
Joined: Tue Jul 17, 2012 3:02 pm

Re: ready access memory retention?

Mon Oct 05, 2015 10:00 am

Is there any particular reason you suspect this data corruption might happen? The Pi is a computer and computers can run fro years without failing. Or at least they have done ever since we stopped building them out of gears, relays or vacuum tubes etc.

There is some concern that a cosmic ray or some radio active decay event can flip bits in the memory chip. Although I don't see any evidence or discussion about that around the net now a days.

If it really worries you then maintain a checksum over the data in memory and check it whenever you use that data.
Memory in C++ is a leaky abstraction .

henryhanselscott
Posts: 107
Joined: Sun Jan 18, 2015 1:31 pm

Re: ready access memory retention?

Mon Oct 05, 2015 11:50 am

Is there any particular reason you suspect this data corruption might happen?


No, it is just the fact that I did not know if this should be a concern or not. In all my previous experiences building controllers with micros I have written the variable data to flash based memory devices, which is also non-volatile. Using the pi, I have use of the RAM and my main concern was if the OS would re-allocate memory locations if they sit idle for long periods of time.
It's unlikely, but if you are worried why not read the data from the file when it's time to make the comparison?
Good point, I was just trying to avoid this if it was not necessary.

Thanks for the replies helping a novice out!

Henry

Return to “General discussion”