Hi there,

I seem to be running into a problem with freeing memory.

Under OS X all is well, but under Linux there seems to be a problem in the
case of linked data structures.

I have attached a python program which demonstrates the problem. The output
of the script for both linux and OS X are below.

Thanks very much in advance, and for the amazing work on PyPy.

OS X:



2.7.8 (857f34cd4254, Oct 14 2014, 22:01:17)

[PyPy 2.5.0-alpha0 with GCC 4.2.1 Compatible Apple LLVM 6.0
(clang-600.0.51)]

Darwin 14.1.0 ('', '', '')



initial 20 MB



0 558 MB

0 30 MB



1 558 MB

1 31 MB



2 558 MB

2 32 MB





Linux:



2.7.8 (dfffd5d7cc7e, Feb 08 2015, 14:59:48)

[PyPy 2.5.0 with GCC 4.8.2]

Linux 3.13.0-44-generic ('debian', 'jessie/sid', '')



initial 82 MB



0 626 MB

0 626 MB



1 627 MB

1 627 MB



2 627 MB

2 627 MB
import psutil, os, gc, platform, sys


class Node(object):
    
    def __init__(self, node):
        self.node = node


def link(n):
    node = None
    for _ in range(n):
        node = Node(node)
    return node


mempct = lambda : '%i MB' % (psutil.Process(os.getpid()).memory_info()[0] / 1024 / 1024)


if __name__ == '__main__':
    
    print sys.version
    print platform.system(), platform.release(), platform.dist()
    print ''

    print 'initial', mempct()
    
    n = int(1e7)

    for i in range(3):
        
        print 
            
        node = link(n)
    
        print i, mempct()
    
        del node
        gc.collect()
    
        print i, mempct()

_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to