No, it is not only freepascal, but not every program either. 

I have just done some quick tests check this.  I have not done any real testing 
to prove whether these are repeatable all the time or not yet.
A file saved with notepad ++ is lost
Partial email drafts in outlook are saved
A file created with Echo "test" > test.txt is saved
Copying a file from the command line seems to end up saving both the source and 
destination.    I tried saving a file with notepad++ then copying the file, and 
after the power failure, both the source and destination were complete.   But 
saving with notepad ++ will always be a string of 00s.  

I wonder if this is a 32/64 bit issue.   Notepad ++ and my free pascal programs 
are both 32bit. 

Perhaps until I can figure out what the copy command is doing to save the file 
to disk, I can just shell execute a copy command on my files and that will end 
up saving them.  I guess if I did that I could run my entire program from a ram 
drive and save some SSD activity and only copy the important files back to the 
SSD and only when they actually change.  

James





-----Original Message-----
From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of 
Santiago A.
Sent: Wednesday, March 22, 2017 4:40 AM
To: FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org>
Subject: Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

El 21/03/2017 a las 15:39, James Richters escribió:
> I should note that these systems are all using Samsung SSDs in them, 
> perhaps there is some SSD weirdness going on?
Yes, I think so.  SSD is special.

The SSD technology like any flash memories have a limited number of rewrites, 
so there are strategies to rewrite as less as possible. In the case of SSD they 
are even more aggressive, because they are expensive .Some of these strategies 
are implemented in the OS in driver level, but some in firmware of the device.  
So, it is possible that OS can't completely force the real write.

> I also notice it's not just this
> one file that is affected, but EVERY SINGLE FILE I create with 
> freepascal,
Only with freepascal?

Try it for a file generated from command line

echo "test" > filetest.txt

And do the same checks... edit notepad++... turnoff power.... etc
> configured a certain way.   I really need these tiny files to survive power
> failures.
Power failures are always a problem for persistent storage. Caching is a 
trade-off between speed and security. In the case of SSD there is a third 
point: Minimize the real writes on disk. So, if you want security against power 
failures, SSD is not the best idea.

By the way. What about a SAI? ;-)


--
Saludos

Santiago A.
s...@ciberpiula.net

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to