Is it a memory leak in python/jupyter?

Viewed 670

I made very simple code in python, which I am running on jupyter:

# Cell 1
data = []
with open('test.txt', mode='r') as f:
    for line in f:
        data.append(line)

The file 'test.txt' has 3.1 Gb, and I can track the memory load.

Afther this, in the next cell, I exclude that:

# Cell 2
del data

But memory usage does not return to the initial state.

The next image is my system monitor. I executed the cell with the exclusion of the variable as soon as I finished the load, which reached almost 80%. But the memory only came back after I interrupted the notebook's kernel.

enter image description here

Isn't that wrong? I think the memory should have been released even on the jupiter, isn't it?

My system is Ubuntu 18.04, and I'm using miniconda, with Python 3.7.7.

0 Answers
Related