mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
don't re-print garbage info if no new garbage
This commit is contained in:
parent
df3fe996b9
commit
90eb2bf52e
@ -509,6 +509,8 @@ class GarbageReport(Job):
|
||||
class GarbageLogger(GarbageReport):
|
||||
"""If you just want to log the current garbage to the log file, make
|
||||
one of these. It automatically destroys itself after logging"""
|
||||
# variable for checkForGarbageLeaks
|
||||
LastNumGarbage = 0
|
||||
def __init__(self, name, *args, **kArgs):
|
||||
kArgs['log'] = True
|
||||
kArgs['autoDestroy'] = True
|
||||
@ -517,7 +519,9 @@ class GarbageLogger(GarbageReport):
|
||||
def checkForGarbageLeaks():
|
||||
gc.collect()
|
||||
numGarbage = len(gc.garbage)
|
||||
if numGarbage and not configIsToday('disable-garbage-logging'):
|
||||
if ((numGarbage != GarbageLogger.LastNumGarbage) and
|
||||
(not configIsToday('disable-garbage-logging'))):
|
||||
GarbageLogger.LastNumGarbage = numGarbage
|
||||
print
|
||||
gr = GarbageLogger('found garbage', threaded=False)
|
||||
print
|
||||
|
Loading…
x
Reference in New Issue
Block a user