# Path: mlat/server/util.py
# def fuzzy(t):
# def safe_wait(coros_or_futures, **kwargs):
#     def process(self, msg, kwargs):
# def setproctitle(title):
# class TaggingLogger(logging.LoggerAdapter):


import asyncio
import gc
import logging
import operator
    import objgraph
from mlat.server import util
Simple periodic memory leak checker.
"""



try:
except ImportError:
    objgraph = None


class LeakChecker(object):
    def __init__(self):
        self.logger = logging.getLogger("leaks")
        self._task = None
        self.peak = {}

    def start(self):
        if objgraph is None:
            self.logger.warning("Leak checking disabled (objgraph not available)")
        else:
            self._task = asyncio.async(self.checker())

        return util.completed_future

    def close(self):
        if self._task:
            self._task.cancel()

    @asyncio.coroutine
    def wait_closed(self):

# Path: mlat/server/util.py
# def fuzzy(t):
# def safe_wait(coros_or_futures, **kwargs):
#     def process(self, msg, kwargs):
# def setproctitle(title):
# class TaggingLogger(logging.LoggerAdapter):


# Path: mlat/server/leakcheck.py
import asyncio
import gc
import logging
import operator
    import objgraph
from mlat.server import util

Simple periodic memory leak checker.
"""



try:
except ImportError:
    objgraph = None


class LeakChecker(object):
    def __init__(self):
        self.logger = logging.getLogger("leaks")
        self._task = None
        self.peak = {}

    def start(self):
        if objgraph is None:
            self.logger.warning("Leak checking disabled (objgraph not available)")
        else:
            self._task = asyncio.async(self.checker())

        return util.completed_future

    def close(self):
        if self._task:
            self._task.cancel()

    @asyncio.coroutine
    def wait_closed(self):

        yield from util.safe_wait([self._task])