summaryrefslogtreecommitdiff
path: root/tests/stress/gc_trace.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-04-04 13:58:57 +1000
committerDamien George <damien.p.george@gmail.com>2018-04-04 14:22:54 +1000
commita45a34ec313d0fb57e2fb1bbacf6e9209483bbe6 (patch)
treed90be2e0b59b395e7698f1af0cdd0d0b4c513709 /tests/stress/gc_trace.py
parent7d5c753b17a1c9cbb8124839af144d0b8b936abc (diff)
tests/stress: Add test to verify the GC can trace nested objects.
Diffstat (limited to 'tests/stress/gc_trace.py')
-rw-r--r--tests/stress/gc_trace.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/stress/gc_trace.py b/tests/stress/gc_trace.py
new file mode 100644
index 000000000..72dc7b627
--- /dev/null
+++ b/tests/stress/gc_trace.py
@@ -0,0 +1,17 @@
+# test that the GC can trace nested objects
+
+try:
+ import gc
+except ImportError:
+ print("SKIP")
+ raise SystemExit
+
+# test a big shallow object pointing to many unique objects
+lst = [[i] for i in range(200)]
+gc.collect()
+print(lst)
+
+# test a deep object
+lst = [[[[[(i, j, k, l)] for i in range(3)] for j in range(3)] for k in range(3)] for l in range(3)]
+gc.collect()
+print(lst)