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:

  1. when you leave it
  2. Li> when you leave the function
  3. 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

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -