When I run the following code on Ubuntu and watch in htop, it peaks out at 900 mb of memory usage until sleep() is done:
import random
import gc
import time
large_dict = {}
for x in xrange(50000):
large_row = {}
for y in xrange(125):
large_row[random.randint(1, 10000000000)] = random.randint(1, 10000000000)
large_dict[random.randint(1, 10000000000)] = large_row
# Force a sweep
large_dict = {}
del large_dict
gc.collect()
time.sleep(60)
However, when I run it on Windows and watch task manager, memory usage is only a few mb after gc.collect().
I tried this code in Ubuntu with Python 2.7.3, 2.7.4, and 2.7.8 with the same results.
Why are Windows and Ubuntu behaving differently? I would prefer Ubuntu to act like Windows and free the memory after gc.collect().