Skip to content

Commit 930d9b7

Browse files
committed
Add comment
1 parent a74720e commit 930d9b7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mypyc/test-data/run-async.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,14 +353,22 @@ import asyncio
353353
import gc
354354

355355
def assert_no_leaks(fn, max_new):
356+
# Warm-up, in case asyncio allocates something on first use
356357
asyncio.run(fn())
358+
357359
gc.collect()
358360
old_objs = gc.get_objects()
361+
359362
for i in range(10):
360363
asyncio.run(fn())
364+
361365
gc.collect()
362366
new_objs = gc.get_objects()
367+
363368
delta = len(new_objs) - len(old_objs)
369+
# Often a few persistent objects get allocated, which may be unavoidable.
370+
# The main thing we care about is that each iteration does not leak an
371+
# additional object.
364372
assert delta <= max_new, delta
365373

366374
async def concat_one(x: str) -> str:

0 commit comments

Comments
 (0)