Merge pull request #1244 from wangtao19930524/bugfix/trim_sigbus_fix

This commit is contained in:
Guo Ling
2024-03-09 09:56:23 +08:00
committed by GitHub
+1 -1
View File
@@ -1388,6 +1388,7 @@ void MMKV::trim() {
SCOPED_LOCK(m_lock);
MMKVInfo("prepare to trim %s", m_mmapID.c_str());
SCOPED_LOCK(m_exclusiveProcessLock);
checkLoadData();
if (!isFileValid()) {
MMKVWarning("[%s] file not valid", m_mmapID.c_str());
@@ -1400,7 +1401,6 @@ void MMKV::trim() {
} else if (m_file->getFileSize() <= m_expectedCapacity) {
return;
}
SCOPED_LOCK(m_exclusiveProcessLock);
fullWriteback();
auto oldSize = m_file->getFileSize();