3v4l.org

run code in 500+ PHP versions simultaneously
<?php class X { public $r; public $r2; public function __destruct() { $this->r2 = null; } } function getCircle() { $a = new X(); $b = new X(); $c = new X(); $a->r = $c; $b->r = $a; $c->r = $b; return $a; } $zeroMemory = memory_get_usage(); $u = getCircle(); $u->r2 = getCircle(); $u = null; gc_collect_cycles(); var_dump(memory_get_usage()- $zeroMemory);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BeuOd
function name:  (null)
number of ops:  20
compiled vars:  !0 = $zeroMemory, !1 = $u
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   23     0  E >   INIT_FCALL                                                   'memory_get_usage'
          1        DO_ICALL                                             $2      
          2        ASSIGN                                                       !0, $2
   25     3        INIT_FCALL                                                   'getcircle'
          4        DO_FCALL                                          0  $4      
          5        ASSIGN                                                       !1, $4
   26     6        INIT_FCALL                                                   'getcircle'
          7        DO_FCALL                                          0  $7      
          8        ASSIGN_OBJ                                                   !1, 'r2'
          9        OP_DATA                                                      $7
   27    10        ASSIGN                                                       !1, null
   28    11        INIT_FCALL                                                   'gc_collect_cycles'
         12        DO_ICALL                                                     
   29    13        INIT_FCALL                                                   'var_dump'
         14        INIT_FCALL                                                   'memory_get_usage'
         15        DO_ICALL                                             $10     
         16        SUB                                                  ~11     $10, !0
         17        SEND_VAL                                                     ~11
         18        DO_ICALL                                                     
         19      > RETURN                                                       1

Function getcircle:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BeuOd
function name:  getCircle
number of ops:  17
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   NEW                                                  $3      'X'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $3
   14     3        NEW                                                  $6      'X'
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !1, $6
   15     6        NEW                                                  $9      'X'
          7        DO_FCALL                                          0          
          8        ASSIGN                                                       !2, $9
   16     9        ASSIGN_OBJ                                                   !0, 'r'
         10        OP_DATA                                                      !2
   17    11        ASSIGN_OBJ                                                   !1, 'r'
         12        OP_DATA                                                      !0
   18    13        ASSIGN_OBJ                                                   !2, 'r'
         14        OP_DATA                                                      !1
   20    15      > RETURN                                                       !0
   21    16*     > RETURN                                                       null

End of function getcircle

Class X:
Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BeuOd
function name:  __destruct
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   ASSIGN_OBJ                                                   'r2'
          1        OP_DATA                                                      null
    9     2      > RETURN                                                       null

End of function __destruct

End of class X.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
170.84 ms | 1623 KiB | 18 Q