作者:c肀xc86_441 | 来源:互联网 | 2023-07-24 19:46
InGooglesNotepadExample,theydontseemtoclosethedatabase,atleastnotinonDestroy().在谷歌
In Google's Notepad Example, they don't seem to close the database, at least not in onDestroy().
在谷歌的记事本示例中,它们似乎不关闭数据库,至少不在onDestroy()中。
What is the purpose of closing it, and do I really need to? Does an open database take up significant memory? I have found that closing it in onDestroy leaves vulnerabilities if there are any threads running that might try to access it after the Activity is finished.
关闭它的目的是什么,我真的需要吗?开放数据库是否会占用大量内存?我发现在onDestroy中关闭它会留下漏洞,如果有任何运行的线程可能会在Activity完成后尝试访问它。
2 个解决方案