About php memory allocation. & Lt ;? Php $ tmemory_get_usage (); 3125000 $ i1; $ a [$ I] $ I; $ i11111111; $ a [$ I] $ I; $ i1; $ a [$ I] $ I; $ i111111111111111111111; $ a [$ I] $ I; echomemor about php memory allocation.
$ T = memory_get_usage ();
// 3125000
$ I = 1;
$ A [$ I] = $ I;
USD I = 1111111111;
$ A [$ I] = $ I;
$ I = '1 ';
$ A [$ I] = $ I;
$ I = '000000 ';
$ A [$ I] = $ I;
Echo memory_get_usage ()-$ t;
?>
How can I calculate the memory occupied by each component. Thank you.
------ Solution --------------------
Follow
Ci1699 is a good question.
------ Solution --------------------
Successive output and observation
The best way is to check how the variable table is constructed in the source code.
------ Solution --------------------
Php is c-based, and memory management is not oriented to php.
For this question, please refer to what laruence said.
Http://www.laruence.com/2011/03/04/1894.html
Http://www.laruence.com/2011/11/09/2277.html
------ Solution --------------------
You should use memory_get_usage (TRUE) for comparison. if both are replaced with TRUE, I guess the output is the same.
In essence, php has its own memory management mechanism, which requires a larger memory block for application.
Then there is a set of memory management structures to reduce the number of system calls
------ Solution --------------------
Discussion
Reference:
Php is c-based, and memory management is not oriented to php.
For this question, please refer to what laruence said.
Http://www.laruence.com/2011/03/04/1894.html
Http://www.laruence.com/2011/11/09/2277.html
To be honest, the articles mentioned in these articles are just a few minutes away.
......
------ Solution --------------------
I am not talking about how to apply for memory, but about how php maintains the variable table.
The php variable should be a structure queue, and each item should at least include: variable name, type, value pointer, whether it is referenced ....
This is what we need to care about, and how he maintains this table. But not very important
------ Solution --------------------
Discussion
I am not talking about how to apply for memory, but about how php maintains the variable table.
The php variable should be a structure queue, and each item should at least include: variable name, type, value pointer, whether it is referenced ....
This is what we need to care about, and how he maintains this table. But not very important
------ Solution --------------------
What a wonderful student ....
Discussion
Thank you, big brother upstairs.
Sina Cloud is sometimes really slow. It cannot be opened for a long time.
I am still tossing the sorting. Last night, I got three more = _ =
I want to use php bitmap for sorting, but it consumes too much memory.
Now we want to optimize it. Paste the code later.
------ Solution --------------------
The predecessors said, let's take a look. I got taught. thank you.
------ Solution --------------------
Laruence is a Chinese developer who went to the core of php.