How does Colab measure RAM?

Viewed 76

tl;dr: process.memory_info().rss heavily disagrees with Colab's RAM meauserement. Why is that?

I'm using Google Colab, and my notebook has a memory leak that I can't identify. I train a neural network using PyTorch, and, according to Colab, my used RAM slowly but surely increases with each iteration. It starts with ~3.5 GB, and then it increases until I the notebook crashes after using all available RAM.

On the other hand, process.memory_info().rss says that I use 3.2 GB, and the value almost doesn't change across iterations.

I'm personally pretty convinced that there is no actual memory leak, and process.memory_info().rss seems to agree. Why does Colab think otherwise?

I'm also not sure if it's Colab's issue, Jupyter's issue, or I'm simply using a wrong way to measure memory.

0 Answers
Related