Can i clear system memory after every scheduled (using schedule.every() method) iteration?

I've made a python code that download information from a new email, using a schedule method. The code is running every 20 seconds looking for the email. The problem is that the use of the system memory increases each time the information from an email is downloaded.

I wanna know if is possible to clear the system memory after data is downloaded (the information has already been stored)

The code is running in background all the time

Python v3.7.8

def main():
   process = psutil.Process(os.getpid())
   print(process.memory_info().rss)

   email.read_email(service)


if __name__ == '__main__':
   schedule.every(20).seconds.do(main)
   while isLocked():
      schedule.run_pending()


Read more here: https://stackoverflow.com/questions/66266431/can-i-clear-system-memory-after-every-scheduled-using-schedule-every-method

Content Attribution

This content was originally published by Edier Yasser Perea at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: