Bug #80373 [Opn->Nab]: Memory leak in big array of strings
Edit report at https://bugs.php.net/bug.php?id=80373&edit=1
ID: 80373
Updated by: cmb@php.net
Reported by: p30neo at gmail dot com
Summary: Memory leak in big array of strings
-Status: Open
+Status: Not a bug
Type: Bug
Package: Arrays related
Operating System: CentOS 7
PHP Version: 7.4.12
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The second script requires more memory, because there are
2,000,000 distinct "Lorem ipsum" strings. For the first example,
the engine optimizes to only use only *one* "Lorem ipsum" string
(it is interned), and as such requires far less memory.
Previous Comments:
------------------------------------------------------------------------
[2020-11-16 01:27:22] p30neo at gmail dot com
Description:
------------
There is Memory leak when we do any string operation in big loops with an array.
Test script:
---------------
Example 1 (Normal):
http://sandbox.onlinephpfunctions.com/code/f597ef30c9f326be47e5822f4276b35a3efa8e86
We have about 66 MB RAM Usage.
----------------
Example 2 (Memory leak):
http://sandbox.onlinephpfunctions.com/code/af719f898c102cdb12d197d06119b05a6765f65d
here we get an error and It will use more than 128MB in this example.
(in example 2 : when we reexecute more times , the memory usage will dcreasing...)
Expected result:
----------------
I expected no memory usage diffrence between those two examples.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80373&edit=1
Thread (2 messages)