ARCCSS-extremes / climpact

Calculate the ET-SCI climate extremes indices
GNU General Public License v3.0
45 stars 31 forks source link

Clear memory on exit #5

Closed jmccomb closed 4 years ago

jmccomb commented 4 years ago

Clear all memory on exit (is this a good idea? See if you can clear only memory allocated by current script). This was a comment from a user and will be less relevant once climpact is hosted online.

jmccomb commented 4 years ago

Currently, memory will be marked for garbage collection by the operating system on exiting the process. The operating system is responsible for reclaiming memory at this point. Although the description doesn't specify what tool is being used, this is just a general statement for any R process that runs, consuming memory and then stops. Memory management covered extensively in StackOverflow (SO), so individual management is possible, see: https://stackoverflow.com/questions/1358003/tricks-to-manage-the-available-memory-in-an-r-session https://stackoverflow.com/questions/8813753/what-is-the-difference-between-gc-and-rm https://stackoverflow.com/questions/11579765/how-to-clean-up-r-memory-without-the-need-to-restart-my-pc https://stackoverflow.com/questions/1467201/forcing-garbage-collection-to-run-in-r-with-the-gc-command https://stackoverflow.com/questions/6313079/quit-and-restart-a-clean-r-session-from-within-r