MCPcopy Create free account
hub / github.com/Tencent/MMKV / doCleanMemoryCache

Method doCleanMemoryCache

Core/MemoryFile.cpp:298–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298void 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
315bool isFileExist(const string &nsFilePath) {
316 if (nsFilePath.empty()) {

Callers

nothing calls this directly

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected