All,
My problem is that when I run my programme the free memory on the workstation reduces and does not increase again even after the run has completed. Is this normal?
Background: I have a perl programme running on Solaris: $ uname -a
SunOS soc08433 5.10 Generic_127111-11 sun4u sparc SUNW,Sun-Blade-2500
The programme reads a hash which contains a number of filenames. It then checks those filenames for: existance, and looks for certain lines in them.
There are approximately 45000 first level keys in the hash and it is 3 levels deep.
There are approximately 800000 occasions where I look at a file, either to check existance or to look for a string in it. The files are all on NFS.
If I run the programme repeatedly, the amount of free memory lost on each run decreases, but after a while the workstation becomes unusable and I have to reboot it (and free goes back to 3.5G or something).
The workstation has 4G of physical memory, and a run of the programme can reduce that by as much as 1.2G.
I am determining free memory on the workstation with "vmstat 2 2".
I run vmstat before and after the programme and take the "free" amount from the second line.
If I run it continuously this looks to be correct. The figures from vmstat tie up with the numbers from "top".
So what appears to be happening is the memory is being used by my programme and is not being made available again even after the programme has exited.
What does the programme do:
The programme opens and closes files (there were situations where I wasn't closing files, I think they are all fixed now).
It reads from the files and compares the contents to known standards.
It stores results in the main hash. It writes an output file, but only once so I don't think this is relevant.
I've tried running only say the first 5000 first level keys, or not running all the tests on each key, but because the problem is a bit elastic, it is hard to determine a pattern. And each run can take a couple of hours.
So the question is:
Is this a memory leak (I don't think so because it persists after the programme has exited).
If it isn't a memory leak, what is it (so that I can search for answers).
What could be causing this? (without seeing my lines of poor code)
Is there anything that I could call near the end to prevent this?
Are there any useful diagnostics that I can run to track this down?
perl -Version produces:
Summary of my perl5 (revision 5 version 8 subversion 4) configuration: and another 70 lines.
I can't change the version of perl or Solaris that I have!
I look forward to your help!
Cheers
Geoff.
Sorry about the formating, I don't seem to have got the hang of that yet!
In reply to memory not freed after perl exits. Solaris. by Workplane
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |