in reply to RE on lines read from in-memory scalar is very slow

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^2: RE on lines read from in-memory scalar is very slow
by hv (Prior) on Feb 20, 2024 at 02:45 UTC
Re^2: RE on lines read from in-memory scalar is very slow
by NERDVANA (Priest) on Feb 20, 2024 at 05:36 UTC
    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.