Hi,
I got a problem with the 'split' function.
I've attached a program that open each file of a directory one at a
time, read the entire content of the file in a scalar, then attempt to
split the data into list elements of one character each, using the empty
split pattern (//).
The result varies based on the input. For some files (when there are not
many in the directory), it works fine.
Sometimes, after having read 5-6 files, the split function begins to
take a very long time before returning. For the next file, it never
returns, and the CPU is busy 100%. I've run strace on the program and I
saw that no system calls occur when it is stuck in the split function.
The memory usage do not grow, either.
Sometimes, the split function do not slow down too much but the memory
usage grows unbounded, even though the files are not so big. It
consumes all the 512 MB of RAM of my system. I don't see any
circularity in the program that could cause the input not to be garbage
collected.
I've tried the program on two computers running Linux (i386) on
Slackware 8. I tried perl 5.6.0 and 5.6.1, both produces similar
output. The 5.6.1 version was recompiled from the sources, using the
default values as the build options.
Am I doing something really stupid in the program or is there a bug in Perl?
Hopefully you can reproduce the problem on your system. Running the
program in /usr/lib/ triggers the problem for me.
Thanks a lot,
Laurent Birtz
Thread Next