Re: huge memory usage in concat op, ZE2
| From: | Andi Gutmans | Date: | Sun, 08 Dec 2002 18:38:22 +0000 |
| Subject: | Re: huge memory usage in concat op, ZE2 | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-92214@lists.php.net to get a copy of this message | ||
At 12:30 AM 12/8/2002 -0800, Tom wrote:
hey there, I'm using the cvs and ZE2, there seems to be some huge memory usage when concatenating a string to a length over 262080 bytes, when the string length gets to that size the malloc call inside zend_mm_add_memory_block starts grabing memory 262168 bytes at a time, every 8th concatenation (i'm concatenating 1 byte at a time). anyone else seen this?It makes sense that this is happening to you. Reaching the point where you add to a string of such size is very bad coding practice (unless you really have no choice). This is because if the memory manager can't realloc() (it very often can't) then it'll have to allocate a new block and use a memcpy() to copy over all of the string. The current code is less than optimal in this case and I can choose various strategies to improve on it but there will always be times where the malloc()/memcpy() will be necessary. So what are you doing? Is it something you have to do? Andi