From 109c1de015eeee385020233e2f8cc6f921149103 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 31 Oct 2014 21:30:46 +0000 Subject: py: Make gc.enable/disable just control auto-GC; alloc is still allowed. gc.enable/disable are now the same as CPython: they just control whether automatic garbage collection is enabled or not. If disabled, you can still allocate heap memory, and initiate a manual collection. --- tests/micropython/heapalloc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests/micropython/heapalloc.py') diff --git a/tests/micropython/heapalloc.py b/tests/micropython/heapalloc.py index c62428a08..b4b27d19b 100644 --- a/tests/micropython/heapalloc.py +++ b/tests/micropython/heapalloc.py @@ -20,7 +20,12 @@ def h(): g(i) # default arg (second one) g(i, i) # 2 args -# call h with heap allocation disabled +# call h with heap allocation disabled and all memory used up gc.disable() +try: + while True: + 'a'.lower # allocates 1 cell for boundmeth +except MemoryError: + pass h() gc.enable() -- cgit v1.2.3