Perl memory leak from pairing statement

While researching a long-term perl program for memory leaks, I tried using Test :: LeakTrace .

Looking at one of the leaks, he reports that I can narrow the leak code to:

/$?/ 

This works: perl -MTest::LeakTrace::Script -e'/$?/' Prints:

SCALAR leak (0x10d3d48) from -e line 1.

Why should I worry about this?

Update: I also tried Devel :: LeakTrace :: Fast , it does not complain about the same code.

+4
source share
1 answer

Assuming you have a leak. Then this:

 perl -e'/$?/ for 1..1E9' 

should make your process grow in memory

  ps -o rss,vsz <PID> 

In my case, it remains stable all the way. You must check it for your installation. Perhaps the leak your module detects is some kind of destruction. You could write a note to the authors of the module to help you figure out its output, you can help them improve it ...

By the way, another thing that confirms the “lack of leakage” for me is that on

  perl -MTest::LeakTrace::Script -e'/$?/ for 1..1000' 

I do not see a few leaking scalars, only one.

+2
source

All Articles