What happens if you do not unset an array before the script is done executing?
I am running through thousands of CSV files, parsing data for hundreds of thousands of customers into arrays. It works fine for the first 5/6 hours then starts bogging down bad.
I run about 5-10 CSVs per execution...I'm wondering if unsetting the arrays in the script would help this or not...I thought they would be unallocated after the script ends. Am I wrong?
As far as I'm aware, arrays -- like all memory -- should die when the script does.
Is your PHP script being invoked by another PHP script? If you're doing it by 'include', that essentially takes your 'lower' level PHP script and plugs it into the higher level one -- which would cause them to persist.
All memory is cleared when the script ends.
Have you tried using memory_get_peak_usage() and memory_get_usage()? They can be useful for finding memory allocation problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With