Example #1
0
def createMemoryLeakFunctionWatcher():
    """
    register function watcher as command
    command can be executed remotely and return structure created by objgraph
    based on result of garbage collection
    """
    for app_type, flag_name in (('cellapp', 'EXPOSE_CELL_APPS'), ('baseapp', 'EXPOSE_BASE_APPS'), ('serviceapp', 'EXPOSE_SERVICE_APPS')):
        try:
            if not hasattr(BigWorld, flag_name):
                continue
            flag = getattr(BigWorld, flag_name)
            BigWorld.addFunctionWatcher('command/garbageCollect%s' % app_type, getGarbageGraph, [], flag, 'Colect %s garbage data and return objgraph result as dot data' % app_type)
        except:
            LOG_CURRENT_EXCEPTION()