[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-qa
Subject:    =?gb18030?B?u9i4tKO6QnVnICM3Nzg3OSBbT3BuLT5OYWJdOiBV?= =?gb18030?B?c2FibGUgbWVtb3J5?=
From:       "=?gb18030?B?1Kfp5MGnqVPB+cPF?=" <2771680986 () qq ! com>
Date:       2019-04-12 8:24:29
Message-ID: tencent_8B2890D21CCDA018F7AEC7D88DB4FAD8F009 () qq ! com
[Download RAW message or body]

[Attachment #2 (text/plain)]

what's the meaning £¿ speak Chinese------------------ ԭʼÓʼþ ------------------
·¢¼þÈË: "nikic"<nikic@php.net>
·¢ËÍʱ¼ä: 2019Äê4Ô 12ÈÕ(ÐÇÆÚÎå) Ï Îç3:48
ÊÕ¼þÈË: "php-bugs"<php-bugs@lists.php.net>;"php-qa"<php-qa@lists.php.net>;
Ö÷Ìâ: Bug #77879 [Opn->Nab]: Usable memory


Edit report at https://bugs.php.net/bug.php?id=77879&edit=1

 ID:                 77879
 Updated by:         nikic@php.net
 Reported by:        xxalfa at gmail dot com
 Summary:            Usable memory
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Testing related
 Operating System:   Windows
 PHP Version:        7.3.4
 Block user comment: N
 Private report:     N

 New Comment:

Memory allocations are restricted to certain sizes for performance reasons. Small \
allocations are rounded up the next largest bin size. When the memory is reallocated \
with a size that still fits within the same bin, the reallocation is performed \
in-place and the reported memory usage will not change.


Previous Comments:
------------------------------------------------------------------------
[2019-04-12 03:06:55] requinix@php.net

No, the memory does not increase by 1024 each time. It increases by whatever amount \
PHP allocates in order to expand the string by another 1024 bytes. As your output \
shows, the last step it went up by 4096 - enough for approximately 4 increases.

Should it have only allocated 1k? Is it bad that PHP is reserving more memory than \
the precise amount it needs at that given moment?

------------------------------------------------------------------------
[2019-04-12 02:58:35] xxalfa at gmail dot com

The script executes successfully because it has detected because the level of memory \
has not changed. However, the level increases by 1024 per cycle, if the function were \
to work properly, the script would continue to work. That's why it's a bug.

------------------------------------------------------------------------
[2019-04-12 02:26:32] requinix@php.net

Your script is quitting because PHP didn't need to allocate more memory to handle \
another 1k characters. Why is that a bug?

------------------------------------------------------------------------
[2019-04-12 01:48:30] xxalfa at gmail dot com

Description:
------------
The following script fills the memory with pointless data. Now the problem: From one \
point, the function "memory_get_usage" returns the same value, although the level has \
changed. This is important if you want to process data and save it only when a \
certain number of results have been generated. The second problem: Why are only 40% \
usable?

Test script:
---------------
<?php

    // C:\Users\User\Desktop\php-on-limit.cmd
    // @echo off
    // title PHP Development Server
    // cd "%cd%"
    // rem "C:\php\php.exe" "php-on-limit.php"
    // "C:\php\php.exe" "-d memory_limit=16M" "php-on-limit.php"
    // pause

    // C:\Users\User\Desktop\php-on-limit.php [PHP:7.3.3][PID:6336]

    //-------------------------------------------------
    // HEAD
    //-------------------------------------------------

    declare( strict_types = 1 );

    header( 'Content-Type:text/plain' );

    error_reporting( E_ALL );

    ini_set( 'display_errors', '1' );

    ini_set( 'html_errors', '0' );

    define( 'CORE_DIR', dirname( __FILE__ ) . DIRECTORY_SEPARATOR );

    isset( $argv ) or trigger_error( 'This is a command terminal application.', \
E_USER_ERROR );

    echo __FILE__ . ' [PHP:' . phpversion() . '][PID:' . getmypid() . ']' . PHP_EOL . \
PHP_EOL;

    //-------------------------------------------------
    // CODE
    //-------------------------------------------------

    $measuring_point_of_time = microtime( true );

    $memory_limit = conversion_back_to_bytes( ini_get( 'memory_limit' ) );

    echo 'memory_limit -- ' . human_readable_file_size( $memory_limit ) . ' -- \
defined limit' . PHP_EOL;

    // $memory_limit *= 0.48; // 48% of 128M can only be used

    // $memory_limit *= 0.47; // 47% of 64M can only be used

    $memory_limit *= 0.40; // 40% of 16M can only be used

    // If the 40% is exceeded, it comes to a fatal error, which is not desirable.

    // Fatal error: Allowed memory size of 16 MByte exhausted (tried to allocate 6 \
MByte).

    echo 'memory_limit -- ' . human_readable_file_size( $memory_limit ) . ' -- usable \
limit' . PHP_EOL;

    echo 'memory_allocated -- ' . human_readable_file_size( memory_get_usage( true ) \
) . ' -- memory_used -- ' . memory_get_usage() . PHP_EOL;

    $something_has_to_be_calculated = true;

    $results_of_the_calculations = null;

    $last_memory_usage = memory_get_usage();

    while ( $something_has_to_be_calculated )
    {
        $results_of_the_calculations .= str_repeat( '1', 1024 );

        $currently_memory_usage = memory_get_usage();

        if ( last_memory_usage )
        {
            echo PHP_EOL . 'Process recording: Memory function has not changed. \
currently_memory_usage and last_memory_usage are ' . $currently_memory_usage . \
PHP_EOL;

            break;
        }

        // echo chr( 0xD );

        echo 'memory_allocated -- ' . human_readable_file_size( memory_get_usage( \
true ) ) . ' -- memory_used -- ' . memory_get_usage() . ' -- data_length -- ' . \
strlen( $results_of_the_calculations );

        echo PHP_EOL;

        if ( memory_get_usage() >= 20 * 1024 * 1024 )
        {
            echo PHP_EOL . 'Process recording: Normal break.' . PHP_EOL;

            break;
        }

        if ( memory_get_usage() >= $memory_limit )
        {
            echo PHP_EOL . 'Process recording: Memory limit reached. Save calculated \
results so far.' . PHP_EOL;

            $results_of_the_calculations = null;
        }

        $last_memory_usage = memory_get_usage();
    }

    echo PHP_EOL;

    $results_of_the_calculations = null;

    echo 'Process recording: Calculations completed. Results are saved.' . PHP_EOL . \
PHP_EOL;

    echo 'Processing time: ' . elapsed_time( $measuring_point_of_time ) . ' seconds.' \
. PHP_EOL . PHP_EOL;

    //-------------------------------------------------
    // FUNCTIONS
    //-------------------------------------------------

    function elapsed_time( $measuring_point_of_time )
    {
        return number_format( microtime( true ) - $measuring_point_of_time, 3 );
    }

    function human_readable_file_size( precision = 2 )
    {
        $label = array( 'Bytes', 'kByte', 'MByte', 'GByte', 'TByte', 'PByte', \
'EByte', 'ZByte', 'YByte' );

        return file_size / pow( 1024, ( file_size, 1024 ) ) ) ), label[ $index ] : '0 \
Bytes';  }

    function conversion_back_to_bytes( $value )
    {
        value, -1 ) );

        if ( value * 1024; endif;

        if ( value * 1048576; endif;

        if ( value * 1073741824; endif;

        return $value;
    }

?>

Expected result:
----------------
The "memory_get_usage" function must continually display the current memory usage to \
effectively operate at the memory limit.

Actual result:
--------------
C:\Users\User\Desktop\php-on-limit.php [PHP:7.3.4][PID:1224]

memory_limit -- 16 MByte -- defined limit
memory_limit -- 6.4 MByte -- usable limit
memory_allocated -- 2 MByte -- memory_used -- 410408
memory_allocated -- 2 MByte -- memory_used -- 411688 -- data_length -- 1024
memory_allocated -- 2 MByte -- memory_used -- 412968 -- data_length -- 2048
memory_allocated -- 2 MByte -- memory_used -- 414504 -- data_length -- 3072
memory_allocated -- 2 MByte -- memory_used -- 418600 -- data_length -- 4096

Process recording: Memory function has not changed. currently_memory_usage and \
last_memory_usage are 418520

Process recording: Calculations completed. Results are saved.

Processing time: 0.001 seconds.


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=77879&edit=1


[Attachment #3 (text/html)]

what's the meaning £¿ speak Chinese<DIV style="COLOR: #000"><DIV \
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; \
PADDING-TOP: 2px; FONT-FAMILY: Arial \
Narrow">------------------&nbsp;ԭʼÓʼþ&nbsp;------------------</DIV><DIV \
style="PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-SIZE: 12px; BACKGROUND: #efefef; \
PADDING-BOTTOM: 8px; PADDING-TOP: \
8px"><DIV><B>·¢¼þÈË:</B>&nbsp;&quot;nikic&quot;&lt;nikic@php.net&gt;<wbr/></DIV><DIV><B>·¢ËÍʱ¼ä:</B>&nbsp;2019Äê4Ô \
12ÈÕ(ÐÇÆÚÎå) Ï Îç3:48</DIV><DIV><B>ÊÕ¼þÈË:</B>&nbsp;&quot;php-bugs&quot;&lt;php-bugs@l \
ists.php.net&gt;;&quot;php-qa&quot;&lt;php-qa@lists.php.net&gt;;</DIV><DIV><B>Ö÷Ìâ:</B>&nbsp;Bug \
#77879 [Opn-&gt;Nab]: Usable memory</DIV></DIV></DIV>Edit report at \
https://bugs.php.net/bug.php?id=77879&amp;edit=1<br/><br/>&nbsp;ID:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
77879<br/>&nbsp;Updated by:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
nikic@php.net<br/>&nbsp;Reported by:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xxalfa \
at gmail dot com<br/>&nbsp;Summary:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Usable memory<br/>-Status:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Open<br/>+Status:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Not a bug<br/>&nbsp;Type:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Bug<br/>&nbsp;Package:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Testing related<br/>&nbsp;Operating System:&nbsp;&nbsp; Windows<br/>&nbsp;PHP \
Version:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7.3.4<br/>&nbsp;Block user \
comment: N<br/>&nbsp;Private report:&nbsp;&nbsp;&nbsp;&nbsp; N<br/><br/>&nbsp;New \
Comment:<br/><br/>Memory allocations are restricted to certain sizes for performance \
reasons. Small allocations are rounded up the next largest bin size. When the memory \
is reallocated with a size that still fits within the same bin, the reallocation is \
performed in-place and the reported memory usage will not \
change.<br/><br/><br/>Previous \
Comments:<br/>------------------------------------------------------------------------<br/>[2019-04-12 \
03:06:55] requinix@php.net<br/><br/>No, the memory does not increase by 1024 each \
time. It increases by whatever amount PHP allocates in order to expand the string by \
another 1024 bytes. As your output shows, the last step it went up by 4096 - enough \
for approximately 4 increases.<br/><br/>Should it have only allocated 1k? Is it bad \
that PHP is reserving more memory than the precise amount it needs at that given \
moment?<br/><br/>------------------------------------------------------------------------<br/>[2019-04-12 \
02:58:35] xxalfa at gmail dot com<br/><br/>The script executes successfully because \
it has detected because the level of memory has not changed. However, the level \
increases by 1024 per cycle, if the function were to work properly, the script would \
continue to work. That&#39;s why it&#39;s a \
bug.<br/><br/>------------------------------------------------------------------------<br/>[2019-04-12 \
02:26:32] requinix@php.net<br/><br/>Your script is quitting because PHP didn&#39;t \
need to allocate more memory to handle another 1k characters. Why is that a \
bug?<br/><br/>------------------------------------------------------------------------<br/>[2019-04-12 \
01:48:30] xxalfa at gmail dot com<br/><br/>Description:<br/>------------<br/>The \
following script fills the memory with pointless data. Now the problem: From one \
point, the function &quot;memory_get_usage&quot; returns the same value, although the \
level has changed. This is important if you want to process data and save it only \
when a certain number of results have been generated. The second problem: Why are \
only 40% usable?<br/><br/>Test \
script:<br/>---------------<br/>&lt;?php<br/><br/>&nbsp;&nbsp;&nbsp; // \
C:\Users\User\Desktop\php-on-limit.cmd<br/>&nbsp;&nbsp;&nbsp; // @echo \
off<br/>&nbsp;&nbsp;&nbsp; // title PHP Development Server<br/>&nbsp;&nbsp;&nbsp; // \
cd &quot;%cd%&quot;<br/>&nbsp;&nbsp;&nbsp; // rem &quot;C:\php\php.exe&quot; \
&quot;php-on-limit.php&quot;<br/>&nbsp;&nbsp;&nbsp; // &quot;C:\php\php.exe&quot; \
&quot;-d memory_limit=16M&quot; &quot;php-on-limit.php&quot;<br/>&nbsp;&nbsp;&nbsp; \
// pause<br/><br/>&nbsp;&nbsp;&nbsp; // C:\Users\User\Desktop\php-on-limit.php \
[PHP:7.3.3][PID:6336]<br/><br/>&nbsp;&nbsp;&nbsp; \
//-------------------------------------------------<br/>&nbsp;&nbsp;&nbsp; // \
HEAD<br/>&nbsp;&nbsp;&nbsp; \
//-------------------------------------------------<br/><br/>&nbsp;&nbsp;&nbsp; \
declare( strict_types = 1 );<br/><br/>&nbsp;&nbsp;&nbsp; header( \
&#39;Content-Type:text/plain&#39; );<br/><br/>&nbsp;&nbsp;&nbsp; error_reporting( \
E_ALL );<br/><br/>&nbsp;&nbsp;&nbsp; ini_set( &#39;display_errors&#39;, &#39;1&#39; \
);<br/><br/>&nbsp;&nbsp;&nbsp; ini_set( &#39;html_errors&#39;, &#39;0&#39; \
);<br/><br/>&nbsp;&nbsp;&nbsp; define( &#39;CORE_DIR&#39;, dirname( __FILE__ ) . \
DIRECTORY_SEPARATOR );<br/><br/>&nbsp;&nbsp;&nbsp; isset( $argv ) or trigger_error( \
&#39;This is a command terminal application.&#39;, E_USER_ERROR \
);<br/><br/>&nbsp;&nbsp;&nbsp; echo __FILE__ . &#39; [PHP:&#39; . phpversion() . \
&#39;][PID:&#39; . getmypid() . &#39;]&#39; . PHP_EOL . \
PHP_EOL;<br/><br/>&nbsp;&nbsp;&nbsp; \
//-------------------------------------------------<br/>&nbsp;&nbsp;&nbsp; // \
CODE<br/>&nbsp;&nbsp;&nbsp; \
//-------------------------------------------------<br/><br/>&nbsp;&nbsp;&nbsp; \
$measuring_point_of_time = microtime( true );<br/><br/>&nbsp;&nbsp;&nbsp; \
$memory_limit = conversion_back_to_bytes( ini_get( &#39;memory_limit&#39; ) \
);<br/><br/>&nbsp;&nbsp;&nbsp; echo &#39;memory_limit -- &#39; . \
human_readable_file_size( $memory_limit ) . &#39; -- defined limit&#39; . \
PHP_EOL;<br/><br/>&nbsp;&nbsp;&nbsp; // $memory_limit *= 0.48; // 48% of 128M can \
only be used<br/><br/>&nbsp;&nbsp;&nbsp; // $memory_limit *= 0.47; // 47% of 64M can \
only be used<br/><br/>&nbsp;&nbsp;&nbsp; $memory_limit *= 0.40; // 40% of 16M can \
only be used<br/><br/>&nbsp;&nbsp;&nbsp; // If the 40% is exceeded, it comes to a \
fatal error, which is not desirable.<br/><br/>&nbsp;&nbsp;&nbsp; // Fatal error: \
Allowed memory size of 16 MByte exhausted (tried to allocate 6 \
MByte).<br/><br/>&nbsp;&nbsp;&nbsp; echo &#39;memory_limit -- &#39; . \
human_readable_file_size( $memory_limit ) . &#39; -- usable limit&#39; . \
PHP_EOL;<br/><br/>&nbsp;&nbsp;&nbsp; echo &#39;memory_allocated -- &#39; . \
human_readable_file_size( memory_get_usage( true ) ) . &#39; -- memory_used -- &#39; \
. memory_get_usage() . PHP_EOL;<br/><br/>&nbsp;&nbsp;&nbsp; \
$something_has_to_be_calculated = true;<br/><br/>&nbsp;&nbsp;&nbsp; \
$results_of_the_calculations = null;<br/><br/>&nbsp;&nbsp;&nbsp; $last_memory_usage = \
memory_get_usage();<br/><br/>&nbsp;&nbsp;&nbsp; while ( \
$something_has_to_be_calculated )<br/>&nbsp;&nbsp;&nbsp; \
{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $results_of_the_calculations .= \
str_repeat( &#39;1&#39;, 1024 );<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
$currently_memory_usage = \
memory_get_usage();<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( \
last_memory_usage )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo PHP_EOL \
. &#39;Process recording: Memory function has not changed. currently_memory_usage and \
last_memory_usage are &#39; . $currently_memory_usage . \
PHP_EOL;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
break;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
}<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // echo chr( 0xD \
);<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo &#39;memory_allocated -- \
&#39; . human_readable_file_size( memory_get_usage( true ) ) . &#39; -- memory_used \
-- &#39; . memory_get_usage() . &#39; -- data_length -- &#39; . strlen( \
$results_of_the_calculations );<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
echo PHP_EOL;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( \
memory_get_usage() &gt;= 20 * 1024 * 1024 \
)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo PHP_EOL \
. &#39;Process recording: Normal break.&#39; . \
PHP_EOL;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
break;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
}<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( memory_get_usage() &gt;= \
$memory_limit )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo PHP_EOL \
. &#39;Process recording: Memory limit reached. Save calculated results so far.&#39; \
. PHP_EOL;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
$results_of_the_calculations = null;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
}<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $last_memory_usage = \
memory_get_usage();<br/>&nbsp;&nbsp;&nbsp; }<br/><br/>&nbsp;&nbsp;&nbsp; echo \
PHP_EOL;<br/><br/>&nbsp;&nbsp;&nbsp; $results_of_the_calculations = \
null;<br/><br/>&nbsp;&nbsp;&nbsp; echo &#39;Process recording: Calculations \
completed. Results are saved.&#39; . PHP_EOL . PHP_EOL;<br/><br/>&nbsp;&nbsp;&nbsp; \
echo &#39;Processing time: &#39; . elapsed_time( $measuring_point_of_time ) . &#39; \
seconds.&#39; . PHP_EOL . PHP_EOL;<br/><br/>&nbsp;&nbsp;&nbsp; \
//-------------------------------------------------<br/>&nbsp;&nbsp;&nbsp; // \
FUNCTIONS<br/>&nbsp;&nbsp;&nbsp; \
//-------------------------------------------------<br/><br/>&nbsp;&nbsp;&nbsp; \
function elapsed_time( $measuring_point_of_time )<br/>&nbsp;&nbsp;&nbsp; \
{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return number_format( microtime( \
true ) - $measuring_point_of_time, 3 );<br/>&nbsp;&nbsp;&nbsp; \
}<br/><br/>&nbsp;&nbsp;&nbsp; function human_readable_file_size( precision = 2 \
)<br/>&nbsp;&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $label = \
array( &#39;Bytes&#39;, &#39;kByte&#39;, &#39;MByte&#39;, &#39;GByte&#39;, \
&#39;TByte&#39;, &#39;PByte&#39;, &#39;EByte&#39;, &#39;ZByte&#39;, &#39;YByte&#39; \
);<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return file_size / pow( 1024, \
( file_size, 1024 ) ) ) ), label[ $index ] : &#39;0 \
Bytes&#39;;<br/>&nbsp;&nbsp;&nbsp; }<br/><br/>&nbsp;&nbsp;&nbsp; function \
conversion_back_to_bytes( $value )<br/>&nbsp;&nbsp;&nbsp; \
{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value, -1 ) \
);<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( value * 1024; \
endif;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( value * 1048576; \
endif;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( value * 1073741824; \
endif;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
$value;<br/>&nbsp;&nbsp;&nbsp; }<br/><br/>?&gt;<br/><br/>Expected \
result:<br/>----------------<br/>The &quot;memory_get_usage&quot; function must \
continually display the current memory usage to effectively operate at the memory \
limit.<br/><br/>Actual \
result:<br/>--------------<br/>C:\Users\User\Desktop\php-on-limit.php \
[PHP:7.3.4][PID:1224]<br/><br/>memory_limit -- 16 MByte -- defined \
limit<br/>memory_limit -- 6.4 MByte -- usable limit<br/>memory_allocated -- 2 MByte \
-- memory_used -- 410408<br/>memory_allocated -- 2 MByte -- memory_used -- 411688 -- \
data_length -- 1024<br/>memory_allocated -- 2 MByte -- memory_used -- 412968 -- \
data_length -- 2048<br/>memory_allocated -- 2 MByte -- memory_used -- 414504 -- \
data_length -- 3072<br/>memory_allocated -- 2 MByte -- memory_used -- 418600 -- \
data_length -- 4096<br/><br/>Process recording: Memory function has not changed. \
currently_memory_usage and last_memory_usage are 418520<br/><br/>Process recording: \
Calculations completed. Results are saved.<br/><br/>Processing time: 0.001 \
seconds.<br/><br/><br/>------------------------------------------------------------------------<br/><br/><br/><br/>--<br/>Edit \
this bug report at https://bugs.php.net/bug.php?id=77879&amp;edit=1<br/>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic