I'm using requests_html to scrape some site :
from requests_html import HTMLSession
for i in range (0,30):
session = HTMLSession()
r = session.get('https://www.google.com')
r.html.render()
del session
Now this code creates more than 30 sub-process of chromium as Python's sub-process. And this acquires memory, so how can I remove them?
I don't want to use psutil, as it will increase one more dependency and to kill python's sub-process python may have some built in method, I want to be enlightened, if there is so
I can't even use exit() as I have to return and then exit(inside a method), and of course I can't exit and return
withascontext managerlike it is used in files opening and it will automatically closes the session just like file.