garbage_collector.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:qudi 作者: Ulm-IQO 项目源码 文件源码
def check(self):
        """
        Method called by the garbage collector timer to check if there is
        something to collect.
        """
        # return self.debug_cycles() # uncomment to just debug cycles
        l0, l1, l2 = gc.get_count()
        if self.debug:
            logger.debug('gc_check called: {0} {1} {2}'.format(l0, l1, l2))
        if l0 > self.threshold[0]:
            num = gc.collect(0)
            if self.debug:
                logger.debug('collecting gen 0, found: {0:d} unreachable'
                             ''.format(num))
            if l1 > self.threshold[1]:
                num = gc.collect(1)
                if self.debug:
                    logger.debug('collecting gen 1, found: {0:d} unreachable'
                                 ''.format(num))
                if l2 > self.threshold[2]:
                    num = gc.collect(2)
                    if self.debug:
                        logger.debug('collecting gen 2, found: {0:d} '
                                     'unreachable'.format(num))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号