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? ]-


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to