I'm looking for a solution to add persistence to my native-code application. It should be simple (no SQL), fast, and most-importantly reliable.

The best approach I can think of is using memory-mapped files. It's as simple and fast as it can get - you simply store the values in plain-data arrays in "memory". However, I don't think it's very reliable - a power failure could leave the database in an inconsistent or corrupted state. Being able to transactionally sync a group of memory-mapped files to disk would solve this, but I don't think it's possible. Also, unless the filesystem supports snapshots or COW cloning (e.g. [Brtfs](http://en.wikipedia.org/wiki/Btrfs)), backups would mean having to stop the application completely while the files are being copied.

Does anyone have better ideas?