00001 # This file is Copyright 2003, 2006, 2007, 2009 Dean Hall. 00002 # 00003 # This file is part of the Python-on-a-Chip program. 00004 # Python-on-a-Chip is free software: you can redistribute it and/or modify 00005 # it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. 00006 # 00007 # Python-on-a-Chip is distributed in the hope that it will be useful, 00008 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00010 # A copy of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1 00011 # is seen in the file COPYING up one directory from this. 00012 00013 # 00014 # Test for Issue #104: Design and implement garbage collection 00015 # 00016 # Run code that will cause a GC and then run more code to see that things 00017 # still work. 00018 # 00019 00020 import sys 00021 00022 print "Heap =", sys.heap() 00023 00024 i = 170 00025 r = range(i) 00026 print "r = range(", i, ")" 00027 00028 print "Heap =", sys.heap() 00029 00030 while i > 0: 00031 i -= 1 00032 r[i] += 10 00033 print "r[i] += 10; for all i" 00034 print "Heap =", sys.heap() 00035 print "Done."