flush-file-buffers · shipping · also Windows file buffer flush

FlushFileBuffers

FlushFileBuffers requests that buffered information for an open Windows file be written to its underlying device.

For an ordinary file, the handle requires GENERIC_WRITE. A nonzero return reports success; zero requires inspecting GetLastError. Named-pipe handles have a different completion contract: a server-side call waits for the client to read the buffered data. [1]

For mapped writes, use FlushViewOfFile followed by FlushFileBuffers to cover dirty mapped pages, file metadata and the documented disk-persistence boundary. Check both results. This sequence is not a multi-write transaction or a substitute for coordinating concurrent writers. [2]

Relations

related
FlushViewOfFile, FILE_FLAG_WRITE_THROUGH, fsync, Memory-mapped file, Storage cache flush, FILE_FLAG_NO_BUFFERING

Citations

  1. Microsoft: FlushFileBuffers, parameters, return value and remarks (accessed 2026-11-14)
  2. Microsoft: FlushViewOfFile, mapped pages and persistence boundaries (accessed 2026-11-14)

Further reading

  1. Hesela: Windows mapped-file synchronization and cache boundaries (accessed 2026-11-14)
Sources & caveats
  • Microsoft Win32 documentation reviewed 14 November 2026; no Windows runtime, power-loss or remote-server experiment was performed.
  • Related POSIX and Linux APIs are comparisons, not claims of equivalent completion or error semantics.

JSON: /data/terms/flush-file-buffers.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. FlushFileBuffers. Hesela. 2026-11-14. https://hesela.dev/terms/flush-file-buffers/