Created
April 21, 2022 02:50
-
-
Save xiongnemo/28c71a8c34199baffe3a86b073e4b3c3 to your computer and use it in GitHub Desktop.
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
import code | |
from guppy import hpy | |
def show_memory_stat(): | |
print("===== GC Count (0th, 1st, 2rd Gen) =====") | |
print(gc.get_count()) | |
h = hpy() | |
heap = h.heap() | |
print("===== Heap =====") | |
print(heap) | |
print("===== Heap by Type =====") | |
print(heap.bytype) | |
print("===== Heap by Referers =====") | |
print(heap.byrcs) | |
print("===== Spawning REPL, send EOF (Ctrl + D on Linux) to quit =====") | |
code.InteractiveConsole(locals=locals()).interact() | |
del heap, h |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment