Does the garbage collector can collect elements which belongs to a script that is under sleep()
condition?
I know that the garbage collector free objects from memory if they aren't referenced (so they are considered to be no more in use).
If the answer is yes, I can free resources before the script continues, so with a higher execution time I can use less memory.
Is my reasoning true?
I'll try to be clearer:
- the script is running
- in the script I make 3 variables eligible for being garbage collection:
$var1 = $var2 = $var3 = null;
or other form to make it properly, this isn't the point - in the script I invoke
sleep(100);
- here is where my question applies: before the time of 100 seconds ends, does the garbage collector can run to free
$var1
,$var2
and$var3
?
Thanks a lot.