Fix memory report. Xdebug no more required. Try = null instead of unset.

This commit is contained in:
Laurent Destailleur 2020-02-23 22:05:59 +01:00
parent 76e33058a8
commit 189c0d675b
2 changed files with 36 additions and 38 deletions

View File

@ -255,13 +255,14 @@ else
$px1->draw($file, $fileurl); $px1->draw($file, $fileurl);
$show1 = $px1->show(); $show1 = $px1->show();
unset($graph_datas);
unset($px1); $px1 = null;
unset($datas); $graph_datas =null;
unset($datamin); $datas = null;
unset($dataall); $datamin = null;
unset($labels); $dataall = null;
unset($amounts); $labels = null;
$amounts = null;
} }
// Graph Balance for the year // Graph Balance for the year
@ -392,13 +393,13 @@ else
$show2 = $px2->show(); $show2 = $px2->show();
unset($px2); $px2 = null;
unset($graph_datas); $graph_datas =null;
unset($datas); $datas = null;
unset($datamin); $datamin = null;
unset($dataall); $dataall = null;
unset($labels); $labels = null;
unset($amounts); $amounts = null;
} }
// Graph 3 - Balance for all time line // Graph 3 - Balance for all time line
@ -460,7 +461,7 @@ else
} }
else else
{ {
$datas[$i] = '' +$solde + $subtotal; $datas[$i] = 0 + $solde + $subtotal;
} }
$datamin[$i] = $object->min_desired; $datamin[$i] = $object->min_desired;
$dataall[$i] = $object->min_allowed; $dataall[$i] = $object->min_allowed;
@ -505,13 +506,13 @@ else
$show3 = $px3->show(); $show3 = $px3->show();
unset($px3); $px3 = null;
unset($graph_datas); $graph_datas =null;
unset($datas); $datas = null;
unset($datamin); $datamin = null;
unset($dataall); $dataall = null;
unset($labels); $labels = null;
unset($amounts); $amounts = null;
} }
// Tableau 4a - Credit/Debit // Tableau 4a - Credit/Debit
@ -634,10 +635,10 @@ else
$show4 = $px4->show(); $show4 = $px4->show();
unset($graph_datas); $px4 = null;
unset($px4); $graph_datas = null;
unset($debits); $debits = null;
unset($credits); $credits = null;
} }
// Tableau 4b - Credit/Debit // Tableau 4b - Credit/Debit
@ -742,10 +743,10 @@ else
$show5 = $px5->show(); $show5 = $px5->show();
unset($graph_datas); $px5 = null;
unset($px5); $graph_datas = null;
unset($debits); $debits = null;
unset($credits); $credits = null;
} }
} }

View File

@ -7618,15 +7618,12 @@ function printCommonFooter($zone = 'private')
$micro_end_time = microtime(true); $micro_end_time = microtime(true);
print ' - Build time: '.ceil(1000 * ($micro_end_time - $micro_start_time)).' ms'; print ' - Build time: '.ceil(1000 * ($micro_end_time - $micro_start_time)).' ms';
} }
if (function_exists("memory_get_usage"))
{ if (function_exists("memory_get_usage")) {
print ' - Mem: '.memory_get_usage(); print ' - Mem: '.memory_get_usage(); // Do not use true here, it seems it takes the peak amount
} }
if (function_exists("xdebug_memory_usage")) if (function_exists("memory_get_peak_usage")) {
{ print ' - Real mem peak: '.memory_get_peak_usage(true);
print ' - XDebug time: '.ceil(1000 * xdebug_time_index()).' ms';
print ' - XDebug mem: '.xdebug_memory_usage();
print ' - XDebug mem peak: '.xdebug_peak_memory_usage();
} }
if (function_exists("zend_loader_file_encoded")) if (function_exists("zend_loader_file_encoded"))
{ {