1

It seems that the memory management of python on Linux and windows are different.
Following is my code snip.
Could some one explain why?
Many thanks.
My python is 2.7.3

class A(object):
  def __init__(self):
    self.a = 'a' * 100

l = [A() for i in xrange(1024 * 1024)]   #alloc a lot of memory
l = None   # On Windows memory will be released, but not on Linux!
Yiting
  • 19
  • 1
  • 4
    "On Windows memory will be released, but not on Linux" How have you arrived to this conclusion? – n. m. could be an AI Nov 26 '15 at 14:00
  • You can see changes of memory usage in Task Manager on Windows, on Linux you can see it by "top" command. :) – Yiting Nov 27 '15 at 01:33
  • This difference is (a) not very meaningful and (b) has nothing to do with Python. To see why (a), run the code 10000 times in a loop. Does Linux version allocate 10000 more memory? To see why (b), do the same exercise in C and compare the results. – n. m. could be an AI Nov 27 '15 at 07:18

0 Answers0