Jan Wagner <[EMAIL PROTECTED]> wrote:
> The above patch fixes the problem for me. No more out of memory messages in
> phpmyadmin when exporting databases after applying the patch and recompiling
> the package.
I've been bitten by the same bug as I'm running Sarge with PHP5 from
backports.org.
I can see the patch that Jan refers to does apply cleanly once you've tidied
it to fit what dpkg-buildpackage needs and removed the line that modifies the
version number of the file (see attached).
This is taken from the link that Jan posted:
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_alloc.c?r1=1.144.2.3.2.19&r2=1.144.2.3.2.20&pathrev=PHP_5_2&view=patch
It'd be great if this could get tested out as I'm not quite daring enough to
try and rebuild PHP under Sarge as it has a build depends on libpcre3-dev
from testing.. :-(
Thanks!
Chris
--
Chris Samuel : http://www.csamuel.org/ : Melbourne, VIC
This email may come with a PGP signature as a file. Do not panic.
For more info see: http://en.wikipedia.org/wiki/OpenPGP
--- old/Zend/zend_alloc.c 2006/12/01 19:41:57 1.144.2.3.2.19
+++ new/Zend/zend_alloc.c 2006/12/01 20:01:19 1.144.2.3.2.20
@@ -472,6 +472,10 @@
}
} else {
prev = &heap->free_buckets[0];
+ while (prev->next_free_block != &heap->free_buckets[0] &&
+ ZEND_MM_FREE_BLOCK_SIZE(prev->next_free_block) < size) {
+ prev = prev->next_free_block;
+ }
}
next = prev->next_free_block;
mm_block->prev_free_block = prev;
@@ -1098,10 +1102,8 @@
static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- size_t true_size, best_size = 0x7fff;
zend_mm_free_block *p, *end, *best_fit = NULL;
-
- true_size = ZEND_MM_TRUE_SIZE(size);
+ size_t true_size = ZEND_MM_TRUE_SIZE(size);
if (ZEND_MM_SMALL_SIZE(true_size)) {
size_t index = ZEND_MM_BUCKET_INDEX(true_size);
@@ -1154,16 +1156,14 @@
end = &heap->free_buckets[0];
for (p = end->next_free_block; p != end; p = p->next_free_block) {
- size_t s = ZEND_MM_FREE_BLOCK_SIZE(p);
- if (s > true_size) {
- if (s < best_size) { /* better fit */
+ if (ZEND_MM_FREE_BLOCK_SIZE(p) >= true_size) {
+ if (ZEND_MM_IS_FIRST_BLOCK(p) ||
+ !ZEND_MM_IS_FIRST_BLOCK(ZEND_MM_PREV_BLOCK(p)) ||
+!ZEND_MM_IS_GUARD_BLOCK(ZEND_MM_NEXT_BLOCK(p)) ||
+p->next_free_block == end) {
best_fit = p;
-best_size = s;
+goto zend_mm_finished_searching_for_block;
}
- } else if (s == true_size) {
- /* Found "big" free block of exactly the same size */
- best_fit = p;
- goto zend_mm_finished_searching_for_block;
}
}
pgp2PgtkEzdH1.pgp
Description: PGP signature