I wrote about ZendMM some time ago
(http://julien-pauli.developpez.com/tutoriels/php/internals/zend-memory-manager/)
, that's in french language ;-)
To shorten the conversation a little bit, I would suggest to trace the
memory with valgrind/massif. That's not too hard if you know what you
do, if n
On Tue, 2011-06-07 at 21:03 +0200, David Zülke wrote:
> 144 (not 114!) bytes is for an integer; I'm not quite sure what the
> overheads are for arrays, which token_get_all() produces in
> abundance :) An empty array seems to occupy 312 bytes of memory.
>
> Also, strings have memory allocated in 8
144 (not 114!) bytes is for an integer; I'm not quite sure what the overheads
are for arrays, which token_get_all() produces in abundance :) An empty array
seems to occupy 312 bytes of memory.
Also, strings have memory allocated in 8 byte increments as far as I know, so
"1" eats up 8 bytes, and
Am i then also correct to assume that the output of
memory_get_peak_usage is used for determining the memory_limit?
Also: after correcting with your new information (zval = 114 bytes
instead of 68) I still have a rather large offset:
640952+2165950+114+(276697*114)+(276697*3*114)+2165950 = 13
memory_get_peak_usage() is the maximum amount of memory used by the VM of PHP
(but not by some extensions for instance) up until the point where that
function is called. So the actual memory usage may be even higher IIRC. But
yeah, you're basically right. I've explained in another message why it
Before I forget; without gc_collect_cycles I get the following output
using memory_get_usage instead of memory_get_peak_usage:
int(634640)
int(635392)
Mike
On Tue, 2011-06-07 at 19:44 +0200, Mike van Riel wrote:
> I have ran the script that you provided and got the following results:
>
I have ran the script that you provided and got the following results:
int(635192)
int(635944)
Which is far less than the peak memory result.
I use memory_get_peak_usage to measure what the worst case memory output
is in my application. I expect this to be the actual memory used (and
thu
One thing to keep in mind of course is that each zval incurs an overhead. $x =
1; requires 144 bytes of memory in total IIRC.
David
On 04.06.2011, at 23:38, Mike van Riel wrote:
> Dear Internals,
>
> During development of DocBlox I encountered a (for me) unusual situation
> with regards to me
Damn I'm an idiot. I meant memory_get_usage() all along. Sorry Mike. Then it'll
make sense... memory_get_usage(), but a gc_collect_cycles() before the second
call.
So, my first email should have had this code in it:
var_dump(memory_get_usage());
token_get_all(file_get_contents(''));
var_dump(me
On Tue, Jun 7, 2011 at 4:28 PM, David Zülke wrote:
> Please test the exact thing I suggested :)
>
AFAIK he did.
" int(640720)
int(244001144)"
except if you suggested something else off-list.
Tyrael
Please test the exact thing I suggested :)
var_dump(memory_get_usage());
token_get_all(file_get_contents());
gc_collect_cycles();
var_dump(memory_get_usage());
memory_get_peak_usage() is irrelevant, and USE_ZEND_ALLOC won't give accurate
results anymore when looking at memory usage.
If the abov
On Mon, 2011-06-06 at 22:30 +0200, Mike van Riel wrote:
> 1. Does it hurt to disable the Zend MM?
> 2. Can it be done from inside a PHP Script?
> 3. Why is the memory consumption so much lower, even lower than my
> calculations?
When you disable Zend MM PHP will not use it but directly the system
David and Pauli,
When I change the test script to:
var_dump(memory_get_peak_usage());
gc_collect_cycles();
token_get_all(file_get_contents());
gc_collect_cycles();
var_dump(memory_get_peak_usage());
And execute the following bash line preceding:
export USE_ZEND_ALLOC=0
Seems like leak.
Try disabling ZendMM to see if something noticeable happens (memory
peak should be lower).
USE_ZEND_ALLOC=0
Cheers,
Julien
On Sun, Jun 5, 2011 at 2:01 PM, David Zülke
wrote:
> Smells like a memory leak if gc_collect_cycles() doesn't fix it.
>
> David
>
>
> On 05.06.2011, at 00:
Smells like a memory leak if gc_collect_cycles() doesn't fix it.
David
On 05.06.2011, at 00:01, Mike van Riel wrote:
> Hey David,
>
> That gives me the following output:
>
>int(640720)
>int(244001144)
>
> Mike
>
> On Sat, 2011-06-04 at 23:51 +0200, David Zülke wrote:
>> What does
>>
Hey David,
That gives me the following output:
int(640720)
int(244001144)
Mike
On Sat, 2011-06-04 at 23:51 +0200, David Zülke wrote:
What does
var_dump(memory_get_peak_usage());
token_get_all(file_get_contents(''));
var_dump(memory_get_peak_usage());
get you?
David
--
PHP Intern
What does
var_dump(memory_get_peak_usage());
token_get_all(file_get_contents(''));
var_dump(memory_get_peak_usage());
get you?
David
On 04.06.2011, at 23:38, Mike van Riel wrote:
> Dear Internals,
>
> During development of DocBlox I encountered a (for me) unusual situation
> with regards to
Dear Internals,
During development of DocBlox I encountered a (for me) unusual
situation
with regards to memory usage.
I hope you can shed some light on this for me as I do not understand.
The situations is as follows:
I have a php file containing about 53 KLOC (including whitespace and
comm
18 matches
Mail list logo