g_instanceDic 单例对象池存在的意义 #732
PApatigers
started this conversation in
General
Replies: 1 comment 2 replies
-
|
It's actually more about the tradition of a KV storage engine. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
目前MMKV 底层始终维护g_instanceDic 单例对象池,缓存所有已经注册过的mmkv实例对象
但由于注册阶段为保证g_instanceDic 的线程安全,所以开辟了g_instanceLock 单例锁,直到实例初始化完成才会释放,
这里会由于某个业务而阻塞其他所有业务的注册,且随着该对象的数据膨胀,这种阻塞会更加频繁。
想问下这里的单例对象池存在的意义,对应文件fd 应该交由上层业务主动管理open , close
Beta Was this translation helpful? Give feedback.
All reactions