I have been using this sometimes ago, if there is a cyclic reference or a stale reference of some sort, it help to spot it.
https://groups.google.com/d/msg/web2py-developers/Rd8hC5aFRZo/UTxZHjAwWcUJ http://mg.pov.lt/objgraph/ Il giorno lunedì 2 febbraio 2015 22:48:17 UTC+1, Louis Amon ha scritto: > > I've installed this memory profiler > <https://github.com/fabianp/memory_profiler> and tried the "profile" > decorator it provides, and the output is pretty awesome ! > > I've ran the exact same request twice, and these are the outputs of the > profile on *gluon.compileapp.run_models_in* : > > *First run* > > Line # Mem usage Increment Line Contents > > ================================================ > > 531 28.8945 MiB 0.0000 MiB @profile(precision=4) > > 532 def run_models_in(environment): > > 533 """ > > 534 Runs all models (in the app > specified by the current folder) > > 535 It tries pre-compiled models first > before compiling them. > > 536 """ > > 537 > > 538 28.8945 MiB 0.0000 MiB folder = environment['request']. > folder > > 539 28.8945 MiB 0.0000 MiB c = environment['request']. > controller > > 540 #f = > environment['request'].function > > 541 28.8945 MiB 0.0000 MiB response = environment['response'] > > 542 > > 543 28.8945 MiB 0.0000 MiB path = pjoin(folder, 'models') > > 544 28.8945 MiB 0.0000 MiB cpath = pjoin(folder, 'compiled') > > 545 28.8945 MiB 0.0000 MiB compiled = os.path.exists(cpath) > > 546 28.8945 MiB 0.0000 MiB if compiled: > > 547 models = sorted(listdir(cpath, > '^models[_.][\w.]+\.pyc$', 0), model_cmp) > > 548 else: > > 549 28.8984 MiB 0.0039 MiB models = sorted(listdir(path, > '^\w+\.py$', 0, sort=False), model_cmp_sep) > > 550 28.8984 MiB 0.0000 MiB models_to_run = None > > 551 41.7812 MiB 12.8828 MiB for model in models: > > 552 41.7656 MiB -0.0156 MiB if response.models_to_run != > models_to_run: > > 553 37.3164 MiB -4.4492 MiB regex = models_to_run = > response.models_to_run[:] > > 554 37.3164 MiB 0.0000 MiB if isinstance(regex, list): > > 555 37.3320 MiB 0.0156 MiB regex = re_compile('|'. > join(regex)) > > 556 41.7656 MiB 4.4336 MiB if models_to_run: > > 557 41.7656 MiB 0.0000 MiB if compiled: > > 558 n = len(cpath)+8 > > 559 fname = model[n:-4]. > replace('.','/')+'.py' > > 560 else: > > 561 41.7656 MiB 0.0000 MiB n = len(path)+1 > > 562 41.7656 MiB 0.0000 MiB fname = model[n:]. > replace(os.path.sep,'/') > > 563 41.7656 MiB 0.0000 MiB if not regex.search(fname) > and c != 'appadmin': > > 564 continue > > 565 41.7656 MiB 0.0000 MiB elif compiled: > > 566 code = read_pyc(model) > > 567 41.7656 MiB 0.0000 MiB > ... -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.