def __init__(self, name, firstCheckDelay = None): Job.__init__(self, name) self._serialNum = serialNum() self._findContainersJob = None self._checkContainersJob = None self._pruneContainersJob = None if firstCheckDelay is None: firstCheckDelay = 60. * 15. # divide by two, since the first check just takes length measurements and # doesn't check for leaks self._nextCheckDelay = firstCheckDelay/2. self._checkDelayScale = config.GetFloat('leak-detector-check-delay-scale', 1.5) self._pruneTaskPeriod = config.GetFloat('leak-detector-prune-period', 60. * 30.) # main dict of id(container)->containerRef self._id2ref = {} # storage for results of check-container job self._index2containerId2len = {} self._index2delay = {} if config.GetBool('leak-container', 0): _createContainerLeak() if config.GetBool('leak-tasks', 0): _createTaskLeak() # don't check our own tables for leaks ContainerLeakDetector.addPrivateObj(ContainerLeakDetector.PrivateIds) ContainerLeakDetector.addPrivateObj(self.__dict__) self.setPriority(Job.Priorities.Min) jobMgr.add(self)
def __init__(self, name, firstCheckDelay = None): Job.__init__(self, name) self._serialNum = serialNum() self._findContainersJob = None self._checkContainersJob = None self._pruneContainersJob = None if firstCheckDelay is None: firstCheckDelay = 60.0 * 15.0 self._nextCheckDelay = firstCheckDelay / 2.0 self._checkDelayScale = config.GetFloat('leak-detector-check-delay-scale', 1.5) self._pruneTaskPeriod = config.GetFloat('leak-detector-prune-period', 60.0 * 30.0) self._id2ref = { } self._index2containerId2len = { } self._index2delay = { } if config.GetBool('leak-container', 0): _createContainerLeak() if config.GetBool('leak-tasks', 0): _createTaskLeak() ContainerLeakDetector.addPrivateObj(ContainerLeakDetector.PrivateIds) ContainerLeakDetector.addPrivateObj(self.__dict__) self.setPriority(Job.Priorities.Min) jobMgr.add(self)
def __init__(self, name, log=True, verbose=False, fullReport=False, findCycles=True, threaded=False, doneCallback=None, autoDestroy=False, priority=None, safeMode=False, delOnly=False, collect=True): # if autoDestroy is True, GarbageReport will self-destroy after logging # if false, caller is responsible for calling destroy() # if threaded is True, processing will be performed over multiple frames # if collect is False, we assume that the caller just did a collect and the results # are still in gc.garbage Job.__init__(self, name) # stick the arguments onto a ScratchPad so we can delete them all at once self._args = ScratchPad(name=name, log=log, verbose=verbose, fullReport=fullReport, findCycles=findCycles, doneCallback=doneCallback, autoDestroy=autoDestroy, safeMode=safeMode, delOnly=delOnly, collect=collect) if priority is not None: self.setPriority(priority) jobMgr.add(self) if not threaded: jobMgr.finish(self)
def __init__(self, name, immediate=False, doneCallback=None): Job.__init__(self, name) self._doneCallback = doneCallback jobMgr.add(self) if immediate: jobMgr.finish(self)
def __init__(self, name, log=True, verbose=False, fullReport=False, findCycles=True, threaded=False, doneCallback=None, autoDestroy=False, priority=None, safeMode=False, delOnly=False, collect=True): Job.__init__(self, name) self._args = ScratchPad(name=name, log=log, verbose=verbose, fullReport=fullReport, findCycles=findCycles, doneCallback=doneCallback, autoDestroy=autoDestroy, safeMode=safeMode, delOnly=delOnly, collect=collect) if priority is not None: self.setPriority(priority) jobMgr.add(self) if not threaded: jobMgr.finish(self)
def __init__(self, obj, maxRefs=100): Job.__init__(self, 'ReferrerSearch') self.obj = obj self.maxRefs = maxRefs self.visited = set() self.depth = 0 self.found = 0 self.shouldPrintStats = False
def __init__(self, obj, maxRefs = 100): Job.__init__(self, 'ReferrerSearch') self.obj = obj self.maxRefs = maxRefs self.visited = set() self.depth = 0 self.found = 0 self.shouldPrintStats = False
def __init__(self, name, leakDetector, on, doneCallback = None): Job.__init__(self, name) self._leakDetector = leakDetector self.notify = self._leakDetector.notify self._on = on self._doneCallback = doneCallback self._ldde = self._leakDetector._getDestroyEvent() self.accept(self._ldde, self._handleLDDestroy) ContainerLeakDetector.addPrivateObj(self.__dict__)
def __init__(self, name, leakDetector, on, doneCallback=None): Job.__init__(self, name) self._leakDetector = leakDetector self.notify = self._leakDetector.notify self._on = on self._doneCallback = doneCallback self._ldde = self._leakDetector._getDestroyEvent() self.accept(self._ldde, self._handleLDDestroy) ContainerLeakDetector.addPrivateObj(self.__dict__)
def __init__(self, name, log = False, limit = None, threaded = False): Job.__init__(self, name) self._log = log self._limit = limit self._visitedIds = set() self._id2pathStr = {} self._id2container = {} self._type2id2len = {} self._instanceDictIds = set() self._queue = Queue() jobMgr.add(self) if threaded == False: jobMgr.finish(self)
def destroy(self): del self._args del self.garbage del self.referrersByReference del self.referrersByNumber del self.referentsByReference del self.referentsByNumber if hasattr(self, 'cycles'): del self.cycles del self._report if hasattr(self, '_reportStr'): del self._reportStr Job.destroy(self)
def __init__(self, name, log=True, verbose=False, fullReport=False, findCycles=True, threaded=False, doneCallback=None, autoDestroy=False, priority=None): # if autoDestroy is True, GarbageReport will self-destroy after logging # if false, caller is responsible for calling destroy() # if threaded is True, processing will be performed over multiple frames Job.__init__(self, name) # stick the arguments onto a ScratchPad so we can delete them all at once self._args = ScratchPad(name=name, log=log, verbose=verbose, fullReport=fullReport, findCycles=findCycles, doneCallback=doneCallback, autoDestroy=autoDestroy) if priority is not None: self.setPriority(priority) jobMgr.add(self) if not threaded: jobMgr.finish(self)
def __init__(self, name, log=False, limit=None, threaded=False): Job.__init__(self, name) self._log = log self._limit = limit # set up our data structures self._visitedIds = set() self._id2pathStr = {} self._id2container = {} self._type2id2len = {} self._instanceDictIds = set() # for breadth-first searching self._queue = Queue() jobMgr.add(self) if not threaded: jobMgr.finish(self)
def __init__(self, name, log=False, limit=None, threaded=False): Job.__init__(self, name) self._log = log self._limit = limit # set up our data structures self._visitedIds = set() self._id2pathStr = {} self._id2container = {} self._type2id2len = {} self._instanceDictIds = set() # for breadth-first searching self._queue = Queue() jobMgr.add(self) if threaded == False: jobMgr.finish(self)
def __init__(self, name, leakDetector): Job.__init__(self, name) self._leakDetector = leakDetector self._id2ref = self._leakDetector._id2ref # these hold objects that we should start traversals from often and not-as-often, # respectively self._id2baseStartRef = {} self._id2discoveredStartRef = {} # these are working copies so that our iterations aren't disturbed by changes to the # definitive ref sets self._baseStartRefWorkingList = ScratchPad(refGen=nullGen(), source=self._id2baseStartRef) self._discoveredStartRefWorkingList = ScratchPad(refGen=nullGen(), source=self._id2discoveredStartRef) self.notify = self._leakDetector.notify ContainerLeakDetector.addPrivateObj(self.__dict__) # set up the base containers, the ones that hold most objects ref = ObjectRef(Indirection(evalStr='__builtin__.__dict__'), id(__builtin__.__dict__)) self._id2baseStartRef[id(__builtin__.__dict__)] = ref # container for objects that want to make sure they are found by # the object exploration algorithm, including objects that exist # just to measure things such as C++ memory usage, scene graph size, # framerate, etc. See LeakDetectors.py if not hasattr(__builtin__, "leakDetectors"): __builtin__.leakDetectors = {} ref = ObjectRef(Indirection(evalStr='leakDetectors'), id(leakDetectors)) self._id2baseStartRef[id(leakDetectors)] = ref for i in self._addContainerGen(__builtin__.__dict__, ref): pass try: base except: pass else: ref = ObjectRef(Indirection(evalStr='base.__dict__'), id(base.__dict__)) self._id2baseStartRef[id(base.__dict__)] = ref for i in self._addContainerGen(base.__dict__, ref): pass try: simbase except: pass else: ref = ObjectRef(Indirection(evalStr='simbase.__dict__'), id(simbase.__dict__)) self._id2baseStartRef[id(simbase.__dict__)] = ref for i in self._addContainerGen(simbase.__dict__, ref): pass
def __init__(self, name, leakDetector): Job.__init__(self, name) self._leakDetector = leakDetector self._id2ref = self._leakDetector._id2ref # these hold objects that we should start traversals from often and not-as-often, # respectively self._id2baseStartRef = {} self._id2discoveredStartRef = {} # these are working copies so that our iterations aren't disturbed by changes to the # definitive ref sets self._baseStartRefWorkingList = ScratchPad(refGen=nullGen(), source=self._id2baseStartRef) self._discoveredStartRefWorkingList = ScratchPad(refGen=nullGen(), source=self._id2discoveredStartRef) self.notify = self._leakDetector.notify ContainerLeakDetector.addPrivateObj(self.__dict__) # set up the base containers, the ones that hold most objects ref = ObjectRef(Indirection(evalStr='builtins.__dict__'), id(builtins.__dict__)) self._id2baseStartRef[id(builtins.__dict__)] = ref # container for objects that want to make sure they are found by # the object exploration algorithm, including objects that exist # just to measure things such as C++ memory usage, scene graph size, # framerate, etc. See LeakDetectors.py if not hasattr(builtins, "leakDetectors"): builtins.leakDetectors = {} ref = ObjectRef(Indirection(evalStr='leakDetectors'), id(leakDetectors)) self._id2baseStartRef[id(leakDetectors)] = ref for i in self._addContainerGen(builtins.__dict__, ref): pass try: base except: pass else: ref = ObjectRef(Indirection(evalStr='base.__dict__'), id(base.__dict__)) self._id2baseStartRef[id(base.__dict__)] = ref for i in self._addContainerGen(base.__dict__, ref): pass try: simbase except: pass else: ref = ObjectRef(Indirection(evalStr='simbase.__dict__'), id(simbase.__dict__)) self._id2baseStartRef[id(simbase.__dict__)] = ref for i in self._addContainerGen(simbase.__dict__, ref): pass
def destroy(self): #print 'GarbageReport.destroy' del self._args del self.garbage # don't get rid of this, we might need it #del self.numGarbage del self.referrersByReference del self.referrersByNumber del self.referentsByReference del self.referentsByNumber if hasattr(self, 'cycles'): del self.cycles del self._report if hasattr(self, '_reportStr'): del self._reportStr Job.destroy(self)
def destroy(self): #print 'GarbageReport.destroy' del self._args del self.garbage # don't get rid of these, we might need them #del self.numGarbage #del self.numCycles del self.referrersByReference del self.referrersByNumber del self.referentsByReference del self.referentsByNumber if hasattr(self, 'cycles'): del self.cycles del self._report if hasattr(self, '_reportStr'): del self._reportStr Job.destroy(self)
def __init__(self, name, leakDetector): Job.__init__(self, name) self._leakDetector = leakDetector self._id2ref = self._leakDetector._id2ref self._id2baseStartRef = { } self._id2discoveredStartRef = { } self._baseStartRefWorkingList = ScratchPad(refGen = nullGen(), source = self._id2baseStartRef) self._discoveredStartRefWorkingList = ScratchPad(refGen = nullGen(), source = self._id2discoveredStartRef) self.notify = self._leakDetector.notify ContainerLeakDetector.addPrivateObj(self.__dict__) ref = ObjectRef(Indirection(evalStr = '__builtin__.__dict__'), id(__builtin__.__dict__)) self._id2baseStartRef[id(__builtin__.__dict__)] = ref if not hasattr(__builtin__, 'leakDetectors'): __builtin__.leakDetectors = { } ref = ObjectRef(Indirection(evalStr = 'leakDetectors'), id(leakDetectors)) self._id2baseStartRef[id(leakDetectors)] = ref for i in self._addContainerGen(__builtin__.__dict__, ref): pass try: pass except: pass ref = ObjectRef(Indirection(evalStr = 'base.__dict__'), id(base.__dict__)) self._id2baseStartRef[id(base.__dict__)] = ref for i in self._addContainerGen(base.__dict__, ref): pass try: pass except: pass ref = ObjectRef(Indirection(evalStr = 'simbase.__dict__'), id(simbase.__dict__)) self._id2baseStartRef[id(simbase.__dict__)] = ref for i in self._addContainerGen(simbase.__dict__, ref): pass
def __init__(self, name, immediate = False, doneCallback = None): Job.__init__(self, name) self._doneCallback = doneCallback jobMgr.add(self) if immediate: jobMgr.finish(self)
def destroy(self): self.ignore(self._ldde) self._leakDetector = None self._doneCallback = None ContainerLeakDetector.removePrivateObj(self.__dict__) Job.destroy(self)
def finished(self): Job.finished(self)
def __init__(self, name, leakDetector): Job.__init__(self, name) self._leakDetector = leakDetector self.notify = self._leakDetector.notify ContainerLeakDetector.addPrivateObj(self.__dict__)
def destroy(self): self._creator = None Job.destroy(self)
def __init__(self, name): Job.__init__(self, name) self.setPriority(Job.Priorities.Normal*2) jobMgr.add(self)
def destroy(self): ContainerLeakDetector.removePrivateObj(self.__dict__) Job.destroy(self)
def destroy(self): self._doneCallback = None Job.destroy(self)
def __init__(self): Job.__init__(self, 'TestJob') self._counter = 0 self._accum = 0 self._finished = False
def destroy(self): self._doneCallback = None Job.destroy(self) return
def __init__(self, name): Job.__init__(self, name) self.setPriority(Job.Priorities.Normal * 2) jobMgr.add(self)
def __init__(self, creator): Job.__init__(self, uniqueName(typeName(self))) self._creator = creator