The question is to the heap, but by the way, how are the anonymous functions (5.3) cleaned? In theory, they should be cleaned up?
- Why clean anonymous functions? Something is not clear what is required ... Variables in them also, and why are the functions themselves? - BOPOH
- @jkeks; Do not create a question in the answer. - Nicolas Chabanovsky ♦
- @Expert is not an answer but a comment. I will also answer the question with a question - why didn’t you have such a question when you used "normal" functions? - Zowie
|
1 answer
Anonymous functions in PHP are ordinary objects of the Closure class. Accordingly, they are cleaned on the same principle as the other objects.
- But it makes no sense to clean them in 99.999% of cases - no, if performance is so important to you, etc. - write in C ++, C #, C, Java, Nodejs etc. But, personally for me, similar questions about php sound ridiculous =) - Zowie
- The meaning of cleaning them is the same as the meaning of cleaning the memory of any other variables - to avoid memory leaks and not rest on the memory limit. This is especially true for scripts working with large amounts of data and scripts constantly hanging in memory (demons) - Ilya Pirogov
|