コード例 #1
0
ファイル: test_boehm.py プロジェクト: antoine1fr/pygirl
 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)
コード例 #2
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)
コード例 #3
0
ファイル: test_newgc.py プロジェクト: pombredanne/pypy
 def fn():
     # the semispace size starts at 8MB for now, so setting a
     # smaller limit has no effect
     # set to more than 32MB -- which should be rounded down to 32MB
     rgc.set_max_heap_size(32*1024*1024 + 20000)
     s1 = s2 = s3 = None
     try:
         s1 = g(400000)      # ~ 400 KB
         s2 = g(4000000)     # ~ 4 MB
         s3 = g(40000000)    # ~ 40 MB
     except MemoryError:
         pass
     return (s1 is not None) + (s2 is not None) + (s3 is not None)
コード例 #4
0
ファイル: test_newgc.py プロジェクト: nipengadmaster/pypy
 def fn():
     # the semispace size starts at 8MB for now, so setting a
     # smaller limit has no effect
     # set to more than 32MB -- which should be rounded down to 32MB
     rgc.set_max_heap_size(32*1024*1024 + 20000)
     s1 = s2 = s3 = None
     try:
         s1 = g(400000)      # ~ 400 KB
         s2 = g(4000000)     # ~ 4 MB
         s3 = g(40000000)    # ~ 40 MB
     except MemoryError:
         pass
     return (s1 is not None) + (s2 is not None) + (s3 is not None)
コード例 #5
0
 def fn():
     # the semispace size starts at 8MB for now, so setting a
     # smaller limit has no effect
     from pypy.rlib import rgc
     rgc.set_max_heap_size(20000000)  # almost 20 MB
     s1 = s2 = s3 = None
     try:
         s1 = g(400000)  # ~ 400 KB
         s2 = g(4000000)  # ~ 4 MB
         s3 = g(40000000)  # ~ 40 MB
     except MemoryError:
         pass
     return (s1 is not None) + (s2 is not None) + (s3 is not None)
コード例 #6
0
ファイル: test_newgc.py プロジェクト: antoine1fr/pygirl
 def fn():
     # the semispace size starts at 8MB for now, so setting a
     # smaller limit has no effect
     from pypy.rlib import rgc
     rgc.set_max_heap_size(20000000)   # almost 20 MB
     s1 = s2 = s3 = None
     try:
         s1 = g(400000)      # ~ 400 KB
         s2 = g(4000000)     # ~ 4 MB
         s3 = g(40000000)    # ~ 40 MB
     except MemoryError:
         pass
     return (s1 is not None) + (s2 is not None) + (s3 is not None)
コード例 #7
0
    def entry_point(argv):
        space.timer.start("Entrypoint")
        if withjit:
            from pypy.jit.backend.hlinfo import highleveljitinfo
            highleveljitinfo.sys_executable = argv[0]

        #debug("entry point starting")
        #for arg in argv:
        #    debug(" argv -> " + arg)
        if len(argv) > 2 and argv[1] == '--heapsize':
            # Undocumented option, handled at interp-level.
            # It has silently no effect with some GCs.
            # It works in Boehm and in the semispace or generational GCs
            # (but see comments in semispace.py:set_max_heap_size()).
            # At the moment this option exists mainly to support sandboxing.
            from pypy.rlib import rgc
            rgc.set_max_heap_size(int(argv[2]))
            argv = argv[:1] + argv[3:]
        try:
            try:
                space.timer.start("space.startup")
                space.call_function(w_run_toplevel, w_call_startup_gateway)
                space.timer.stop("space.startup")
                w_executable = space.wrap(argv[0])
                w_argv = space.newlist([space.wrap(s) for s in argv[1:]])
                space.timer.start("w_entry_point")
                w_exitcode = space.call_function(w_entry_point, w_executable,
                                                 w_argv, w_os)
                space.timer.stop("w_entry_point")
                exitcode = space.int_w(w_exitcode)
                # try to pull it all in
            ##    from pypy.interpreter import main, interactive, error
            ##    con = interactive.PyPyConsole(space)
            ##    con.interact()
            except OperationError, e:
                debug("OperationError:")
                debug(" operror-type: " + e.w_type.getname(space))
                debug(" operror-value: " +
                      space.str_w(space.str(e.get_w_value(space))))
                return 1
        finally:
            try:
                space.timer.start("space.finish")
                space.call_function(w_run_toplevel, w_call_finish_gateway)
                space.timer.stop("space.finish")
            except OperationError, e:
                debug("OperationError:")
                debug(" operror-type: " + e.w_type.getname(space))
                debug(" operror-value: " +
                      space.str_w(space.str(e.get_w_value(space))))
                return 1
コード例 #8
0
    def entry_point(argv):
        space.timer.start("Entrypoint")
        if withjit:
            from pypy.jit.backend.hlinfo import highleveljitinfo
            highleveljitinfo.sys_executable = argv[0]

        #debug("entry point starting") 
        #for arg in argv: 
        #    debug(" argv -> " + arg)
        if len(argv) > 2 and argv[1] == '--heapsize':
            # Undocumented option, handled at interp-level.
            # It has silently no effect with some GCs.
            # It works in Boehm and in the semispace or generational GCs
            # (but see comments in semispace.py:set_max_heap_size()).
            # At the moment this option exists mainly to support sandboxing.
            from pypy.rlib import rgc
            rgc.set_max_heap_size(int(argv[2]))
            argv = argv[:1] + argv[3:]
        try:
            try:
                space.timer.start("space.startup")
                space.call_function(w_run_toplevel, w_call_startup_gateway)
                space.timer.stop("space.startup")
                w_executable = space.wrap(argv[0])
                w_argv = space.newlist([space.wrap(s) for s in argv[1:]])
                space.timer.start("w_entry_point")
                w_exitcode = space.call_function(w_entry_point, w_executable, w_argv, w_os)
                space.timer.stop("w_entry_point")
                exitcode = space.int_w(w_exitcode)
                # try to pull it all in
            ##    from pypy.interpreter import main, interactive, error
            ##    con = interactive.PyPyConsole(space)
            ##    con.interact()
            except OperationError, e:
                debug("OperationError:")
                debug(" operror-type: " + e.w_type.getname(space))
                debug(" operror-value: " + space.str_w(space.str(e.get_w_value(space))))
                return 1
        finally:
            try:
                space.timer.start("space.finish")
                space.call_function(w_run_toplevel, w_call_finish_gateway)
                space.timer.stop("space.finish")
            except OperationError, e:
                debug("OperationError:")
                debug(" operror-type: " + e.w_type.getname(space))
                debug(" operror-value: " + space.str_w(space.str(e.get_w_value(space))))
                return 1