If your program crashes, any buffered data will not be cleared. The OS simply says, βOh dear, you left the file descriptor open, I better close it for you,β when the process ends; he does not suspect that some random data lies somewhere in memory, that the program is designed to be written to disk, but did not.
source share