downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Control de la salida> <Ejemplos
[edit] Last updated: Fri, 17 May 2013

view this page in

Uso básico

Ejemplo básico del uso de la extension memtrack:

Ejemplo #1 Crear una matriz grande en una función

<?php

/* /tmp/ejemplo1.php */

function foo() {
    
$a = array();
    for (
$i 0$i 10000$i++) $a[] = "test";
    return 
$a;
}
$arr foo();

?>

Ejecutar el ejemplo con el siguiente comando:

php -d memtrack.enabled=1 -d memtrack.soft_limit=1M -d memtrack.vm_limit=3M /tmp/ejemplo1.php

El resultado del ejemplo sería algo similar a:

Warning: [memtrack] [pid 26177] user function foo() executed in /tmp/ejemplo1.php on line 10 allocated 4194304 bytes in /tmp/ejemplo1.php on line 0
Warning: [memtrack] [pid 26177] virtual memory usage on shutdown: 32911360 bytes in Unknown on line 0


add a note add a note User Contributed Notes Uso básico - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites