3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NonLeakingClass { protected $x=[1,2,3,4,5,6,7,8,9,10]; public function __counstruct(){ } } class NonLeakingClass2 { protected $x=[1,2,3,4,5,6,7,8,9,10]; public function __counstruct(){ } } function test($x){ $ret = []; for($i=0;$i<(1022/2)*$x;$i++){ $ret[] = new NonLeakingClass(); $ret[] = new NonLeakingClass2(); } return $ret; } for ($h = 1; $h < 5; $h++) { echo "test $h \n\n"; var_dump(memory_get_usage(false)); $a = test($h); unset($a); gc_collect_cycles(); var_dump(memory_get_usage(false)); } exit;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 2
Branch analysis from position: 28
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 2
Branch analysis from position: 28
Branch analysis from position: 2
filename:       /in/5ap4Z
function name:  (null)
number of ops:  30
compiled vars:  !0 = $h, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   ASSIGN                                                   !0, 1
          1      > JMP                                                      ->26
   29     2    >   ROPE_INIT                                     3  ~4      'test+'
          3        ROPE_ADD                                      1  ~4      ~4, !0
          4        ROPE_END                                      2  ~3      ~4, '+%0A%0A'
          5        ECHO                                                     ~3
   30     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'memory_get_usage'
          8        SEND_VAL                                                 <false>
          9        DO_ICALL                                         $6      
         10        SEND_VAR                                                 $6
         11        DO_ICALL                                                 
   31    12        INIT_FCALL                                               'test'
         13        SEND_VAR                                                 !0
         14        DO_FCALL                                      0  $8      
         15        ASSIGN                                                   !1, $8
   32    16        UNSET_CV                                                 !1
   33    17        INIT_FCALL                                               'gc_collect_cycles'
         18        DO_ICALL                                                 
   34    19        INIT_FCALL                                               'var_dump'
         20        INIT_FCALL                                               'memory_get_usage'
         21        SEND_VAL                                                 <false>
         22        DO_ICALL                                         $11     
         23        SEND_VAR                                                 $11
         24        DO_ICALL                                                 
   28    25        PRE_INC                                                  !0
         26    >   IS_SMALLER                                               !0, 5
         27      > JMPNZ                                                    ~14, ->2
   37    28    > > EXIT                                                     
   38    29*     > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 4
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 4
Branch analysis from position: 16
Branch analysis from position: 4
filename:       /in/5ap4Z
function name:  test
number of ops:  18
compiled vars:  !0 = $x, !1 = $ret, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        ASSIGN                                                   !1, <array>
   20     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->13
   21     4    >   NEW                                              $6      'NonLeakingClass'
          5        DO_FCALL                                      0          
          6        ASSIGN_DIM                                               !1
          7        OP_DATA                                                  $6
   22     8        NEW                                              $9      'NonLeakingClass2'
          9        DO_FCALL                                      0          
         10        ASSIGN_DIM                                               !1
         11        OP_DATA                                                  $9
   20    12        PRE_INC                                                  !2
         13    >   MUL                                              ~12     !0, 511
         14        IS_SMALLER                                               !2, ~12
         15      > JMPNZ                                                    ~13, ->4
   24    16    > > RETURN                                                   !1
   26    17*     > RETURN                                                   null

End of function test

Class NonLeakingClass:
Function __counstruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5ap4Z
function name:  __counstruct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E > > RETURN                                                   null

End of function __counstruct

End of class NonLeakingClass.

Class NonLeakingClass2:
Function __counstruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5ap4Z
function name:  __counstruct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E > > RETURN                                                   null

End of function __counstruct

End of class NonLeakingClass2.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.17 ms | 1407 KiB | 20 Q