Re: leak()
| From: | Derick Rethans | Date: | Tue, 19 Nov 2002 21:22:11 +0000 |
| Subject: | Re: leak() | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-91334@lists.php.net to get a copy of this message | ||
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? ]-