3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NonLeakingClass { } //echo "Test empty object memory leakage" . PHP_EOL; // WARNING: Uncomment this line and PHP stops to leak memory on object creation, strange :) for ($h = 0; $h < 5; $h++) { var_dump(memory_get_usage(false)); $a = new NonLeakingClass(); 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 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 2
Branch analysis from position: 23
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 2
Branch analysis from position: 23
Branch analysis from position: 2
filename:       /in/dSB4T
function name:  (null)
number of ops:  25
compiled vars:  !0 = $h, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->21
    9     2    >   INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'memory_get_usage'
          4        SEND_VAL                                                 <false>
          5        DO_ICALL                                         $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
   10     8        NEW                                              $5      'NonLeakingClass'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $5
   11    11        UNSET_CV                                                 !1
   12    12        INIT_FCALL                                               'gc_collect_cycles'
         13        DO_ICALL                                                 
   13    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'memory_get_usage'
         16        SEND_VAL                                                 <false>
         17        DO_ICALL                                         $9      
         18        SEND_VAR                                                 $9
         19        DO_ICALL                                                 
    8    20        PRE_INC                                                  !0
         21    >   IS_SMALLER                                               !0, 5
         22      > JMPNZ                                                    ~12, ->2
   16    23    > > EXIT                                                     
   17    24*     > RETURN                                                   1

Class NonLeakingClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.28 ms | 1399 KiB | 19 Q