Created
April 30, 2019 17:44
-
-
Save nbraud/caf2c7a37d74d3ae83bbe402a723f2cd to your computer and use it in GitHub Desktop.
PPB: Reveal which cycles are created (and collected) on each frame
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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