Freeing 0x001361F0 (24 bytes) (fwd)

From: Date: Thu, 30 Sep 1999 22:27:13 +0000
Subject: Freeing 0x001361F0 (24 bytes) (fwd)
Groups: php.dev 
Request: Send a blank email to php-dev+get-11402@lists.php.net to get a copy of this message
Greeting! I have a memory leak problem. Hope you guys can take a look. Thanks in advance. One class file, one test script, and the error message is ./t.htm: Freeing 0x001361F0 (24 bytes), allocated in zend_execute.c on line 1550<br> ./t.htm: Freeing 0x0015C920 (4 bytes), allocated in zend_hash.c on line 185<br> ./t.htm: Freeing 0x0015C8C0 (41 bytes), allocated in zend_hash.c on line 175<br> Also. My httpd reached 18M when doing test of similar scripts which php3. Here is the test script ########################################### #!/usr/local/bin/php4 <?php error_reporting(63); include("./class.test"); newhtml(&$w); echo "DDD\n"; printhtml(); ?> Here is the class file ########################################### <?php $_SEED = md5(microtime()); function newhtml(&$w,$a = '') { # Start the HTML page global $_LAYOUT,$_CURRENT_LINE,$_INDENT; $_LAYOUT = array(); $_CURRENT_LINE = $_INDENT = ''; $w = window(&$a); } function printhtml() { # Print out the final page global $_LAYOUT,$_CURRENT_LINE; $GLOBALS['_layout_all']->printit(); $_LAYOUT[] = $_CURRENT_LINE; reset($_LAYOUT); while(list(,$_line) = each($_LAYOUT)) { echo $_line."\n"; } } function insert($p,$c) { $GLOBALS["$p"]->insert($c); } function window($a = '') { global $_layout_all, $_layout_header; $_layout_all = new Container('HTML'); if(isset($a["indent"]) && !$a["indent"]) { $_layout_all->ident = false; } # Header Part $_layout_header = new Container('HEAD'); insert('_layout_all','_layout_header'); # Body Part $na = rname(); $GLOBALS["$na"] = new Container('BODY',&$a); insert('_layout_all',$na); return $na; } # Internal Functions function rname() { global $_SEED; static $_CNT = 0; ++$_CNT; return $_SEED.$_CNT; } function getclass($c) { return $GLOBALS["$c"]->classname; } # Classes class HTMLBase { var $classname = 'htmlbase' ; var $ident = true; var $settings; var $children = ""; var $level = 0; var $default = ""; function insert($c) { $this->children[] = $c ; $GLOBALS["$c"]->level = $this->level + 1; if(!$this->ident) { $GLOBALS["$c"]->ident = $this->ident; } } function printchild() { if (is_array($this->children)) { reset($this->children); while( list($key,$ch) = each($this->children) ) { $val = $this->children[$key]; $this->indent(+1); $GLOBALS["$val"]->printit(); $this->indent(); } } } function indent($p = 0) { global $_LAYOUT,$_CURRENT_LINE,$_INDENT; $l = $this->level + $p ; $_INDENT = ''; for( $i=0; $i < $l ; ++$i ) { $_INDENT .= ' '; } if($this->ident) { $_line = trim($_CURRENT_LINE); if(!empty($_line)) { $_LAYOUT[] = $_CURRENT_LINE; } $_CURRENT_LINE = $_INDENT; } } function setparam($a = '') { $temp = array(); $this->settings = '' ; $def = 'def_' . $this->classname; global $$def; if ( is_array($this->default) ) { while( list($key,$val) = each($this->default) ) { $temp["$key"] = $val; } } if ( is_array(${$def}) ) { reset(${$def}); while( list($key,$val) = each(${$def}) ) { $temp["$key"] = $val; } } if ( is_array($a) ) { reset($a); while( list($key,$val) = each($a) ) { $temp["$key"] = $val; } } reset($temp); while (list($key,$val) = each($temp) ) { $key = strtoupper($key); if ( $key == 'COLS' && $this->classname == 'table' ) { $this->cols = $val; continue; } if ( $key == 'INDENT' ) { $this->ident = $val; continue; } if ( $key == 'COLSPAN' ) { $this->cs = $val; } if ( $key == 'ROWSPAN' ) { $this->rs = $val; } if ( $val == 'undef' || $val == 'UNDEF' ) { $this->settings .= " $key"; } else { $this->settings .= " $key=\"$val\""; } } } } class Container extends HTMLBase { var $classname = 'container'; var $tag = 'none'; function Container($t,$a = '') { $this->classname = strtolower($t); $this->tag = strtoupper($t); $this->setparam($a); } function printit() { global $_CURRENT_LINE; $_CURRENT_LINE .= '<' . $this->tag . $this->settings . '>'; $this->printchild(); $this->indent(); $_CURRENT_LINE .= '</' . $this->tag . '>'; } } ?>

« previous php.dev (#11402) next »