Bug#402506: [php-maint] Bug#402506: Memory leak PHP5.2.0-7 Fatal error: Out of memory

2006-12-17 Thread Chris Samuel
On Sunday 17 December 2006 12:16 am, Jan Wagner wrote:

 pcre3 is backported on bpo.

Understood, but seemed to want to drag in a number of other dependencies.. :-(

 Anyways ... you can give 
 http://ftp.cyconet.org/debian/archive/bpo/php5/5.2.0-7~bpo.2~testing.1/ a 
 try.

That works really well, the problems I was seeing seem to have gone away.

Great stuff and thanks so much!

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


pgpeeTXYgjpeW.pgp
Description: PGP signature


Bug#402506: [php-maint] Bug#402506: Memory leak PHP5.2.0-7 Fatal error: Out of memory

2006-12-17 Thread Jan Wagner
On Sunday 17 December 2006 11:36, Chris Samuel wrote:
  Anyways ... you can give
  http://ftp.cyconet.org/debian/archive/bpo/php5/5.2.0-7~bpo.2~testing.1/ a
  try.

 That works really well, the problems I was seeing seem to have gone away.

Sean, seems adding 114-zend_alloc_mm_fix.patch fixes the problem, so go 
ahead! ;)

With regards, Jan.
-- 
Never write mail to [EMAIL PROTECTED], you have been warned!
-BEGIN GEEK CODE BLOCK-
Version: 3.1
GIT d-- s+: a- C+++ UL P+ L+++ E- W+++ N+++ o++ K++ w--- O M V- PS PE
Y++ PGP++ t-- 5 X R tv- b+ DI- D++ G++ e++ h-- r+++ y+++
--END GEEK CODE BLOCK--


pgpXcSBIIbut5.pgp
Description: PGP signature


Bug#402506: [php-maint] Bug#402506: Memory leak PHP5.2.0-7 Fatal error: Out of memory

2006-12-16 Thread Jan Wagner
Hi all,

On Saturday 16 December 2006 11:43, Chris Samuel wrote:
 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.

 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.. :-(

pcre3 is backported on bpo. Anyways ... you can give 
http://ftp.cyconet.org/debian/archive/bpo/php5/5.2.0-7~bpo.2~testing.1/ a 
try. Here is the changelog entry:

 php5 (5.2.0-7~bpo.2~testing.1) sarge-backports; urgency=low
 .
   * build for sarge
   * fixing memory leak with 114-zend_alloc_mm_fix.patch (see #402506 and
 http://bugs.php.net/bug.php?id=39438)
   * Built against libapr0-dev, libdb4.2-dev, libmysqlclient14-dev,
 libsqlite3-dev, libsqlite0-dev and libsnmp5-dev.
 .

With kind regards, Jan.
-- 
Never write mail to [EMAIL PROTECTED], you have been warned!
-BEGIN GEEK CODE BLOCK-
Version: 3.1
GIT d-- s+: a- C+++ UL P+ L+++ E- W+++ N+++ o++ K++ w--- O M V- PS PE
Y++ PGP++ t-- 5 X R tv- b+ DI- D++ G++ e++ h-- r+++ y+++
--END GEEK CODE BLOCK--
--- php.orig/Zend/zend_alloc.c	2006/12/01 19:41:57	1.144.2.3.2.19
+++ php/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;
 		}
 	}
 


pgp88zhGBJidY.pgp
Description: PGP signature


Bug#402506: [php-maint] Bug#402506: Memory leak PHP5.2.0-7 Fatal error: Out of memory

2006-12-15 Thread sean finney
hi jan,

On Fri, 2006-12-15 at 10:40 +0100, Jan Wagner 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.

what above patch?  :)

i've dug out the relevant commits from ZendEngine2 cvs, but i haven't
had a chance to massage them into place on the php5 source tree (they
overlap at least one already existing patch in svn).


sean


signature.asc
Description: This is a digitally signed message part


Bug#402506: [php-maint] Bug#402506: Memory leak PHP5.2.0-7 Fatal error: Out of memory

2006-12-11 Thread sean finney
severity 402506 serious
tags 402506 upstream
forwarded 402506 http://bugs.php.net/bug.php?id=39438
thanks

they say it's fixed in CVS now, but we'll have to do some
digging to find the fix.


sean



signature.asc
Description: This is a digitally signed message part