Scenario-
I am running B* instances on App Engine. I've a background ETL related task(written in python) scheduled as a cron job on App Engine. When time arrives, cron initiates a http request to start the task and runs without returning a response till the task gets completed. When task was executing, it was typically consuming "X" MB of RAM. After the task got finished and returned 200 OK, App Engine Instance monitoring is still showing "X" MB of RAM in use.
Please help me understand the following -
- If an instance is running only one task and after completing it, when will memory get freed that was consumed by this task?
- Do I need to run
gc.collect()
to call the garbage collector explicitly to free up RAM ? - The only way to free up RAM is to restart the instance ?
PS: This is not at all related to NDB, my task is taking input from Bigquery, performing some ETL operation and then streaming it to Bigquery.