Code: Select all
del
Or does it not have an immediate effect anyway and would I have to call
Code: Select all
gc.collect()
Code: Select all
del
Code: Select all
gc.collect()
Code: Select all
while True:
a={}
a.update(await get_results())
await asyncio.sleep(10)
a.update(await get_other_results())
await publish(a)
del a
gc.collect()
await do_something()
await asyncio.sleep(10)
await do_something()
I don't understand the "until all modules are imported" part.Calling gc.collect() regularly until all modules are imported is an important part in keeping the RAM usable.
Code: Select all
import module1
gc.collect()
import module2
gc.collect()
import module3
gc.collect()
obj=module1.Class()
gc.collect()
I'd say after sending the mail you should call gc.collect() to free all temporary stuff. Also as mentioned above after each import. Before calling a function or importing modules is not needed, if collect was called after importing etc.say I am running a while loop collecting data and once a day I call uMail to send the log. When would be the best times to call gc.collect()? Before calling a .py file that imports umail, before calling a function in umail or after sending the log has finished and I drop back to collecting data?
To expand on this, the point is that the statementkevinkk525 wrote: ↑Thu Jul 15, 2021 5:09 am...In my project I import multiple modules. After each import statement I call gc.collect()...
Code: Select all
import module