found the memory-critical pieces. also removed old debug code

This commit is contained in:
David Halter
2012-08-13 16:45:33 +02:00
parent e6f6003476
commit 37b5f2cb93
6 changed files with 7 additions and 31 deletions

View File

@@ -75,7 +75,8 @@ def clear_caches():
for m in memoize_caches:
m.clear()
memoize_caches = []
# memorize_caches must never be deleted, because the dicts will get lost in
# the wrappers.
statement_path = []
faked_scopes = []

View File

@@ -70,6 +70,7 @@ class Definition(object):
def __init__(self, definition):
""" The definition of a function """
self.definition = definition
self._def_parent = self.definition.parent() # just here to limit gc
par = self.definition
while True:
@@ -319,15 +320,3 @@ def set_debug_function(func_cb):
def _clear_caches():
evaluate.clear_caches()
return
import gc
#gc.set_debug(gc.DEBUG_STATS | gc.DEBUG_COLLECTABLE | gc.DEBUG_UNCOLLECTABLE | gc.DEBUG_OBJECTS)
#gc.collect()
count = 0
for o in gc.get_objects():
if isinstance(o, parsing.Module):
pass
count += 1
#print o
print count
#exit()

View File

@@ -7,9 +7,6 @@ import parsing
import builtin
import debug
files = {}
load_module_cb = None
class Module(builtin.CachedModule):
"""

View File

@@ -1334,7 +1334,6 @@ class PyFuzzyParser(object):
"""
buf = BytesIO(self.code)
self.gen = tokenize_func(buf.readline)
self.currentscope = self.scope # TODO remove?
extended_flow = ['else', 'elif', 'except', 'finally']
statement_toks = ['{', '[', '(', '`']
@@ -1346,8 +1345,6 @@ class PyFuzzyParser(object):
token_type, tok = self.next()
#debug.dbg('main: tok=[%s] type=[%s] indent=[%s]'\
# % (tok, token_type, start_position[0]))
#print('main: tok=[%s] type=[%s] indent=[%s]'
# % (tok, tokenize.tok_name[token_type], self.start_pos[0]))
while token_type == tokenize.DEDENT \
and self.scope != self.module:

View File

@@ -1,9 +0,0 @@
from PySide import QtCore
from PySide import QtGui
##? ['QEvent']
QtCore.QEvent
##? []
QtGui.QButton

View File

@@ -9,8 +9,8 @@ sys.path.append('.')
import functions
from _compatibility import unicode, BytesIO
only_line = int(sys.argv[2]) if len(sys.argv) > 2 else None
if only_line is not None:
only_line = [int(o) for o in sys.argv[2:]]
if only_line:
import debug
debug.debug_function = \
functions.debug.print_to_stdout
@@ -164,7 +164,7 @@ def run_test(source, f_name):
correct = None
else:
# reset the test, if only one specific test is wanted
if only_line and line_nr != only_line:
if only_line and line_nr not in only_line:
correct = None
return tests, fails
@@ -209,5 +209,6 @@ print('\nSummary:')
for s in summary:
print(s)
exit_code = 0 if tests_pass else 1
sys.exit(exit_code)