Beispiel #1
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
Beispiel #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)
Beispiel #3
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)
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #7
0
 def f():
     s.dels = 0
     for i in range(10):
         g()
     llop.gc__collect(lltype.Void)
     return s.dels
Beispiel #8
0
 def f():
     s.dels = 0
     for i in range(10):
         g()
     llop.gc__collect(lltype.Void)
     return s.dels