Of course, your Python program could have a bug in it. Although these language interpreters have automatic memory management, you do need to make sure that there are no lingering references to memory which you did allocate, which would prevent the interpreter's "garbage collector" from doing its job.
But also remember that operating systems (and languages, for that matter ...) are lazy by design. If they don't have to do something, they won't. If the system isn't under any memory-pressure, then: "the RAM is there to be used, so let us use it without any further ado." Memory-cleanup would (literally) be a waste of time. The storage allocation might therefore be larger than it ordinarily would be, just because it can be.
If you're observing memory pressure from a Python program, then it will either be one of two things: it really is a bigger program than you thought, or it has some kind of bug in it.
|