Jump to content

How to release memory in PHP


ashly

Recommended Posts

If you finish a function, memory for variable accessible ONLY in that function will be reused automatically.  Variables accessible outside the function will not be freed automatically.

 

If variables are still in scope and you want to reuse their memory, you should use unset($var).

 

Edit: And if the script finishes, then all memory used by it will be freed (in theory, there's some bugs related to that in php4, I think they are fixed in php5).

what about the memory_get_usage() function? is it the real memory space used by the script?

bcse i got a value -51269756 when i checked in my script.. what is the mening of -ve value? and it makes problem for me to execute the  script completely. i have increased the ini setting value for memory_limit and set it to 500 MB..

anyway, my problem is not that function.. i thought it was because of memory limit.. my script doesn't complete the execution and it results in "Network Error (tcp_error) ". I have to make around 6 pdf's in a single script. but there is a large amount of data.. around 1500 records in each pdf.  but i cannot even finish one pdf.

 

can anyone help me to sort out the problem?

 

Thanks

Ashly

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.