Memory Issues with PHP (5) -
Is calling unset ()
free from memory related to that object? There are some cases where I feel myself dealing with large associative arrays and want to remove them whenever they are done (freeing memory to make new ones).
< / Strong>
Check yourself by using:
echo memory_get_usage (). "& Lt; br / & gt;"; Not set ($ array ['key']); Not set ($ array ['key2']); Not set ($ array ['key3']); Echo memory_get_usage (); Quoted from the link later:
PHP stores garbage on three primary junctions:
- when you leave it
Li> when you leave the function - When the script ends
Position 1 occurs when you use unset () , mysql_free_result (), or other resource-deleting functions Clearly clear after your variables, position 2 clearly clear the resources Is - no one gives variable which left scope, that is no longer applicable, your clean. Finally, position 3 vests all script-related resources.
Comments
Post a Comment