P
P
pixxxel2012-09-10 18:56:03
PHP
pixxxel, 2012-09-10 18:56:03

PHP 5.2.6 addslashes() has a memory leak?

$mem = memory_get_usage();
for($i=0;$i<1000;$i++)
{
      print(memory_get_usage()-$mem."<br>");
      $mem = memory_get_usage();
      addslashes('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
}


Result:
148
84
60
60
60
60
60
60
60
60
...

With a large number of iterations, the script dies from lack of memory.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Melkij, 2012-09-10
@melkij

What do you want to hear? Yes, it appears to be leaking. But 5.2.x has long been outdated and is not supported.
In 5.3.3 - the memory is in place, zeros are displayed.
I dug out 5.2.6 (5.2.6-1+lenny16 with Suhosin-Patch 0.9.6.2) - at the first 850 iterations, it flows at 76, then - 0.

C
charliez, 2012-09-10
@charliez

on 5.2.17 it doesn’t flow, I found 5.1.6 - it flows :)

E
edogs, 2012-09-10
@edogs

5.2.17 does not flow, so do not put a cross on 5.2.*.
It is also very curious why you add lashes in cms, is it not for working with the base case?

S
sn00p, 2012-09-21
@sn00p

Judging by the changelog for the 5.4.x branch, the developers have really screwed up and there can be no talk of any kind of production at all.
Every month they have a release that fixes a couple dozen segfaults and a couple dozen more memory leaks and other critical bugs.
We have already given up experimenting, stopped at 5.3.13

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question