size should be uint64_t to be consistent on different platforms (esp. 32-bit ones)