direct.showbase.ContainerLeakDetector

from direct.showbase.ContainerLeakDetector import CheckContainers, ContainerLeakDetector, FPTObjsNamed, FPTObjsOfType, FindContainers, Indirection, NoDictKey, ObjectRef, PruneObjectRefs

Inheritance diagram

Inheritance diagram of direct.showbase.ContainerLeakDetector

class CheckContainers(name, leakDetector, index)[source]

Bases: Job

Job to check container sizes and find potential leaks; sub-job of ContainerLeakDetector

ReprItems = 5
__init__(name, leakDetector, index)[source]
destroy()[source]
getPriority()[source]
run()[source]
class ContainerLeakDetector(name, firstCheckDelay=None)[source]

Bases: Job

Low-priority Python object-graph walker that looks for leaking containers. To reduce memory usage, this does a random walk of the Python objects to discover containers rather than keep a set of all visited objects; it may visit the same object many times but eventually it will discover every object. Checks container sizes at ever-increasing intervals.

PrivateIds: set[int] = {}
__init__(name, firstCheckDelay=None)[source]
classmethod addPrivateObj(obj)[source]
destroy()[source]
getContainerById(id)[source]
getContainerByIdGen(id, **kwArgs)[source]
getContainerIds()[source]
getContainerNameById(id)[source]
getContainerNameByIdGen(id, **kwArgs)[source]
getLeakEvent()[source]
getPathsToContainers(name, ot, doneCallback=None)[source]
getPathsToContainersNamed(name, on, doneCallback=None)[source]
notify = <direct.directnotify.Notifier.Notifier object>
removeContainerById(id)[source]
classmethod removePrivateObj(obj)[source]
run()[source]
class FPTObjsNamed(name, leakDetector, on, doneCallback=None)[source]

Bases: Job

__init__(name, leakDetector, on, doneCallback=None)[source]
destroy()[source]
finished()[source]
getPriority()[source]
run()[source]
class FPTObjsOfType(name, leakDetector, otn, doneCallback=None)[source]

Bases: Job

__init__(name, leakDetector, otn, doneCallback=None)[source]
destroy()[source]
finished()[source]
getPriority()[source]
run()[source]
class FindContainers(name, leakDetector)[source]

Bases: Job

Explore the Python graph, looking for objects that support __len__()

__init__(name, leakDetector)[source]
destroy()[source]
getPriority()[source]
static getStartObjAffinity(startObj)[source]
run()[source]
class Indirection(evalStr=None, dictKey=<class 'direct.showbase.ContainerLeakDetector.NoDictKey'>)[source]

Bases: object

Represents the indirection that brings you from a container to an element of the container. Stored as a string to be used as part of an eval, or as a key to be looked up in a dict. Each dictionary dereference is individually eval’d since the dict key might have been garbage-collected TODO: store string components that are duplicates of strings in the actual system so that Python will keep one copy and reduce memory usage

__init__(evalStr=None, dictKey=<class 'direct.showbase.ContainerLeakDetector.NoDictKey'>)[source]
acquire()[source]
dereferenceDictKey(parentDict)[source]
destroy()[source]
getString(prevIndirection=None, nextIndirection=None)[source]
isDictKey()[source]
release()[source]
class NoDictKey[source]

Bases: object

class ObjectRef(indirection, objId, other=None)[source]

Bases: object

stores a reference to a container in a way that does not prevent garbage collection of the container if possible stored as a series of ‘indirections’ (obj.foo -> ‘.foo’, dict[key] -> ‘[key]’, etc.)

exception FailedEval[source]

Bases: Exception

__init__(indirection, objId, other=None)[source]
destroy()[source]
getContainerGen(getInstance=False)[source]
getEvalStrGen(getInstance=False)[source]
getFinalIndirectionStr()[source]
getNumIndirections()[source]
goesThrough(obj=None, objId=None)[source]
goesThroughGen(obj=None, objId=None)[source]
notify = <direct.directnotify.Notifier.Notifier object>
class PruneObjectRefs(name, leakDetector)[source]

Bases: Job

Job to destroy any container refs that are no longer valid. Checks validity by asking for each container

__init__(name, leakDetector)[source]
destroy()[source]
getPriority()[source]
run()[source]