I'm still getting MemoryError exceptions in RPython, as I mentioned a few months back. I only knew of one way to reproduce it back then, but now I'm seeing different ways. So, inspired, I wrote a short program to quickly exhaust memory in the hopes of reproducing the problem. It seems to work! Fast!
If you run the code pasted at the bottom with CPython, it should end printing 'test passed'. If you run the code with pypy 1.9 (I tried Windows), you should get: RPython traceback: File "translator_goal_targetpypystandalone.c", line 1048, in entry_point File "interpreter_function.c", line 929, in funccall__star_1 File "interpreter_function.c", line 958, in funccall__star_1 File "rpython_memory_gc_minimark.c", line 2518, in MiniMarkGC_collect_and_rese rve File "rpython_memory_gc_minimark.c", line 2220, in MiniMarkGC_minor_collection File "rpython_memory_gc_minimark.c", line 4258, in MiniMarkGC_collect_oldrefs_ to_nursery File "rpython_memory_gc_base.c", line 1799, in trace___trace_drag_out File "rpython_memory_gc_minimark.c", line 6667, in MiniMarkGC__malloc_out_of_n ursery_nonsmall Fatal RPython error: MemoryError Can someone else at least confirm this? Thanks, -Roger Flores exhaust-mem.py: """ Code to exhaust memory and generate a MemoryError exception """ size = 1 # find the largest memory allocation that succeeds try: while True: new_size = size * 2 d = [0] * size size = new_size except MemoryError as msg: pass l = [] # exhaust memory while True: try: # add the allocations to a list so references to them remain. # otherwise the garbage collector will clean them out! l.append([0] * size) print '{:,}'.format(size) except MemoryError as msg: if size > 1: # can't allocate this much memory anymore. Try a smaller size size = size / 2 else: print 'test passed' break _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev