Why does exponentiation result in a memory leak?

asked 2024-03-26 21:11:48 +0200

millermj gravatar image

The code

for i in range(17000000):
input("Press enter to finish")

results in a 1GB memory leak. Why? In particular, why doesn't garbage collection deal with this?

edit retag flag offensive close merge delete


What about also indenting input ?!

dan_fulea gravatar imagedan_fulea ( 2024-03-27 17:28:38 +0200 )edit

I do not see any memory leak in Sage 10.3 under Linux. Memory consumption remains constant while the for loop is running.

Max Alekseyev gravatar imageMax Alekseyev ( 2024-03-31 18:00:36 +0200 )edit