PyTorch Developer Podcast
PyTorch Developer Podcast
Edward Yang, Team PyTorch
Sep 1, 2021 · 16 min

DataLoader with multiple workers leaks memory

MP3

Today I'm going to talk about a famous issue in PyTorch, DataLoader with num_workers > 0 causes memory leak (https://github.com/pytorch/pytorch/issues/13246). This bug is a good opportunity to talk about DataSet/DataLoader design in PyTorch, fork and copy-on-write memory in Linux and Python reference counting; you have to know about all of these things to understand why this bug occurs, but once you do, it also explains why the workarounds help.

Further reading.

This podcast uses Simplecast for stats and dynamic audio. What this means Episodes play from the podcast's own servers, unmodified. Not affiliated with Podbay.