| [reply] |
For example, I noticed that sometimes in Windows when a scalar goes out of scope, it should be cleaned up. Right? But that's not what happens. Instead, it stays in the memory until the perl script ends. Or if you say "undef $Variable" then it cleans up the memory and I can see a drop in memory usage when I'm watching Task Manager. But otherwise, it just stays there like a zombie
This is a behavior of old perls, such as 5.8. The "my" variables get allocated and then under the assumption that the function will get called again with similar-sized scalars, they don't get freed, just overwritten on the next function call. Newer perls have some kind of heuristic to prevent this from gobbling large amounts of memory.
| [reply] |