且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用Python卸载模块

更新时间:2023-12-04 22:24:46

Python不支持卸载模块.

Python does not support unloading modules.

但是,除非您的程序随时间加载了无限数量的模块,否则这不是内存泄漏的根源.模块通常在启动时加载一次,仅此而已.您的内存泄漏很可能在其他地方.

However, unless your program loads an unlimited number of modules over time, that's not the source of your memory leak. Modules are normally loaded once at start up and that's it. Your memory leak most likely lies elsewhere.

在不太可能的情况下,随着时间的推移,您的程序确实确实加载了无限数量的模块,您可能应该重新设计程序. ;-)

In the unlikely case that your program really does load an unlimited number of modules over time, you should probably redesign your program. ;-)