Is there any way to release the memory by deleting the modules that have been imported in the script.
I have checked many articles, somebody says python does not have the functionality. However, others show some method to do that. Finally, I found those answers are quite misleading.
Use pandas as an example. I tried: Approach 1:
del pandas
Result 1: you cannot call pandas anymore, but the memory has not been released.
Approach 2:
import sys
modules = sys.modules() #this return a dict
del modules['some module key']
Result 2: you cannot call the module anymore, the same is that the memory has not been released.
Some packages like pandas are very useful but very heavy. I want to release the memory if I no longer need them. Thanks in advance for any hint.