I have a hard time beliving this. Java can have memory leaks so why couldn't Python?
I have a hard time beliving this. Java can have memory leaks so why couldn't Python?
There are indeed many interpretations of what a memory leak is in Python.
In C/C++, you can forget to free memory, thus causing memory leaks. For example, you may call malloc(), but forget to call free(). In Python or Java, you can't do that; you don't need to explicitly "free" objects, as there's a GC.
Sure, you could leave rogue Python or Java objects in memory, but in my mind this isn't a "leak" in the same sense as a leak in C/C++. The Python interpreter (which is written in C) or some C extension may themselves cause real leaks, though.
I'm the author of the post. Maybe my reasoning was not explained clearly enough.
In the post's definition, a memory leak is memory you can no longer reach but is still allocated. That's eliminated by Java and Python.
Of course, you can still waste memory in Java or Python in a variety of ways. But that's a different definition of memory leak then the post is using.