| 296 | } |
| 297 | |
| 298 | void MemoryFile::doCleanMemoryCache(bool forceClean) { |
| 299 | # ifdef MMKV_ANDROID |
| 300 | if (m_diskFile.m_fileType == MMFILE_TYPE_ASHMEM && !forceClean) { |
| 301 | return; |
| 302 | } |
| 303 | # endif |
| 304 | if (m_ptr && m_ptr != MAP_FAILED) { |
| 305 | if (munmap(m_ptr, m_size) != 0) { |
| 306 | MMKVError("fail to munmap [%s], %s", m_diskFile.m_path.c_str(), strerror(errno)); |
| 307 | } |
| 308 | } |
| 309 | m_ptr = nullptr; |
| 310 | |
| 311 | m_diskFile.close(); |
| 312 | m_size = 0; |
| 313 | } |
| 314 | |
| 315 | bool isFileExist(const string &nsFilePath) { |
| 316 | if (nsFilePath.empty()) { |