Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PPB: Reveal which cycles are created (and collected) on each frame
diff --git i/ppb/engine.py w/ppb/engine.py
index 4300133..bc25616 100644
--- i/ppb/engine.py
+++ w/ppb/engine.py
@@ -101,6 +101,7 @@ class GameEngine(Engine, EventMixin, LoggingMixin):
def main_loop(self, collect_statistics: True) -> 'pandas.DataFrame': pass
def main_loop(self, collect_statistics=False):
+ collect_statistics = False
if collect_statistics:
import numpy as np
import pandas as pd
@@ -111,6 +112,7 @@ class GameEngine(Engine, EventMixin, LoggingMixin):
for column in columns:
stats[column] = stats[column].astype(float)
+ gc.set_debug(gc.DEBUG_SAVEALL)
with gc_disabled():
for frame_count in count():
if not self.running:
@@ -129,8 +131,11 @@ class GameEngine(Engine, EventMixin, LoggingMixin):
self.manage_scene()
scene_end = time.monotonic()
- gc_unreachable = gc.collect() if frame_count % 100 == 99 else 0
+ gc_unreachable = gc.collect()
gc_end = time.monotonic()
+ if gc.garbage:
+ print(gc.garbage)
+ gc.garbage.clear()
if collect_statistics:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.