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).

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.