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

search for in the

オブジェクトのオーバーロード> <
Last updated: Fri, 13 Nov 2009

view this page in

memtrack 拡張モジュールの基本的な使用例です。

例1 関数内での巨大な配列の作成

<?php

/* /tmp/example1.php */

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

?>

このサンプルを、次のようなコマンドで実行します。

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

上の例の出力は、 たとえば以下のようになります。

Warning: [memtrack] [pid 26177] user function foo() executed in /tmp/example1.php on line 10 allocated 4194304 bytes in /tmp/example1.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
関数内での巨大な配列の作成
There are no user contributed notes for this page.

オブジェクトのオーバーロード> <
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites