Skip to content

Commit f6c6780

Browse files
debug memory leak in wave
1 parent b445167 commit f6c6780

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

examples/wave.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ def main(actx_class, use_profiling=False, use_logmgr=False, lazy: bool = False):
124124
logmgr_add_device_memory_usage(logmgr, queue)
125125
logmgr_add_mempool_usage(logmgr, alloc)
126126

127-
logmgr.add_watches(["step.max", "t_step.max", "t_log.max"])
127+
logmgr.add_watches(["step.max"])
128128

129129
try:
130-
logmgr.add_watches(["memory_usage_python.max", "memory_usage_gpu.max"])
130+
logmgr.add_watches(["memory_usage_mempool_managed.max", "memory_usage_mempool_active.max"])
131131
except KeyError:
132132
pass
133133

@@ -152,18 +152,19 @@ def rhs(t, w):
152152
if logmgr:
153153
logmgr.tick_before()
154154

155+
gc.collect()
156+
155157
fields = rk4_step(fields, t, dt, compiled_rhs)
156158
fields = force_evaluation(actx, fields)
157159

158-
if istep % 10 == 0:
159-
if use_profiling:
160-
print(actx.tabulate_profiling_data())
161-
print(istep, t, actx.to_numpy(op.norm(dcoll, fields[0], 2)))
162-
vis.write_vtk_file("fld-wave-%04d.vtu" % istep,
163-
[
164-
("u", fields[0]),
165-
("v", fields[1:]),
166-
], overwrite=True)
160+
if istep == 10:
161+
gc.set_debug(gc.DEBUG_SAVEALL)
162+
gc.collect()
163+
gc.set_debug(0)
164+
obj_list = gc.garbage
165+
166+
for obj in obj_list:
167+
print(type(obj))
167168

168169
t += dt
169170
istep += 1

0 commit comments

Comments
 (0)