Re: leak()

From: Date: Tue, 19 Nov 2002 21:31:09 +0000
Subject: Re: leak()
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-91335@lists.php.net to get a copy of this message
hi derick thanx for answering... do i understand it right? this function is used for generating a memory leak which you want to test? and whats about this function emalloc() ... i did not find it on php.net. i suppose it is used to alloc memory? regards, jürg zgraggen "Derick Rethans" <derick@php.net> schrieb im Newsbeitrag news:Pine.LNX.4.44.0211192220570.2421-100000@jdi.jdimedia.nl... > On Tue, 19 Nov 2002, Juerg Zgraggen wrote: > > > hi > > > > does anybody know how the function leak() works? > > can anybody explain? > > It leaks memory, by only running an emalloc without a free: > > /* {{{ proto void leak(int num_bytes=3) > Cause an intentional memory leak, for testing/debugging purposes */ > ZEND_FUNCTION(leak) > { > int leakbytes=3; > zval **leak; > > if (ZEND_NUM_ARGS()>=1) { > if (zend_get_parameters_ex(1, &leak)==SUCCESS) { > convert_to_long_ex(leak); > leakbytes = (*leak)->value.lval; > } > } > > emalloc(leakbytes); > } > /* }}} */ > > Derick > > -- > > -------------------------------------------------------------------------- - > Derick Rethans > http://derickrethans.nl/ > JDI Media Solutions > --------------[ if you hold a unix shell to your ear, do you hear the c? ]- >

« previous php.dev (#91335) next »