示例#1
0
文件: test_boehm.py 项目: njues/Sypy
    def test_refcount_pyobj(self):
        from pypy.rpython.lltypesystem.lloperation import llop

        def prob_with_pyobj(b):
            return 3, b

        def collect():
            llop.gc__collect(lltype.Void)

        f = self.getcompiled(prob_with_pyobj, [object])
        c = self.getcompiled(collect, [])
        from sys import getrefcount as g
        obj = None
        before = g(obj)
        f(obj)
        f(obj)
        f(obj)
        f(obj)
        f(obj)
        c()
        c()
        c()
        c()
        c()
        after = g(obj)
        assert abs(before - after) < 5
示例#2
0
 def fn():
     from pypy.rlib import rgc
     rgc.set_max_heap_size(500000)
     s1 = s2 = s3 = None
     try:
         s1 = g(10000)
         s2 = g(100000)
         s3 = g(1000000)
     except MemoryError:
         pass
     return (s1 is not None) + (s2 is not None) + (s3 is not None)
示例#3
0
文件: test_boehm.py 项目: njues/Sypy
 def fn():
     from pypy.rlib import rgc
     rgc.set_max_heap_size(500000)
     s1 = s2 = s3 = None
     try:
         s1 = g(10000)
         s2 = g(100000)
         s3 = g(1000000)
     except MemoryError:
         pass
     return (s1 is not None) + (s2 is not None) + (s3 is not None)
示例#4
0
def test_refcount_pyobj():
    def prob_with_pyobj(b):
        return 3, b

    f = compile(prob_with_pyobj, [object])
    from sys import getrefcount as g
    obj = None
    before = g(obj)
    f(obj)
    after = g(obj)
    assert before == after
示例#5
0
def test_refcount_pyobj():
    def prob_with_pyobj(b):
        return 3, b

    f = compile(prob_with_pyobj, [object])
    from sys import getrefcount as g
    obj = None
    before = g(obj)
    f(obj)
    after = g(obj)
    assert before == after
示例#6
0
 def test_refcount_pyobj(self):
     from pypy.rpython.lltypesystem.lloperation import llop
     def prob_with_pyobj(b):
         return 3, b
     def collect():
         llop.gc__collect(lltype.Void)
     f = self.getcompiled(prob_with_pyobj, [object])
     c = self.getcompiled(collect, [])
     from sys import getrefcount as g
     obj = None
     before = g(obj)
     f(obj)
     f(obj)
     f(obj)
     f(obj)
     f(obj)
     c()
     c()
     c()
     c()
     c()
     after = g(obj)
     assert abs(before - after) < 5
示例#7
0
 def f():
     s.dels = 0
     for i in range(10):
         g()
     llop.gc__collect(lltype.Void)
     return s.dels
示例#8
0
文件: test_boehm.py 项目: njues/Sypy
 def f():
     s.dels = 0
     for i in range(10):
         g()
     llop.gc__collect(lltype.Void)
     return s.dels