phpconpl 2013 - allowed memory size of x bytes exhausted
TRANSCRIPT
![Page 1: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/1.jpg)
Allowed memory size of X bytes exhausted
Piotr Pasich piotr.pasich @xsolve.pl @piotrpasich
![Page 2: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/2.jpg)
„A good understanding of how variables are stored
and manipulated is essential to becoming
a Hacker.” php.net
![Page 3: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/3.jpg)
„A good understanding of how variables are stored
and manipulated is essential to becoming
a Hacker.” php.net
![Page 4: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/4.jpg)
Have you ever thought why don't you do this?
![Page 5: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/5.jpg)
public function foo() { $a = new stdClass; $b = array(); //(...) unset($a); unset($b); return; }
![Page 6: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/6.jpg)
It might save memory
![Page 7: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/7.jpg)
But it doesn't
![Page 8: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/8.jpg)
It...
![Page 9: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/9.jpg)
S...KS
![Page 10: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/10.jpg)
STACKS
![Page 11: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/11.jpg)
![Page 12: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/12.jpg)
First in, last out
![Page 13: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/13.jpg)
It's mostly used to store variables in functions
![Page 14: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/14.jpg)
So, variables live only in functions
![Page 15: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/15.jpg)
Not PHP functions, but C functions
![Page 16: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/16.jpg)
One PHP function != One C function
![Page 17: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/17.jpg)
They are allocated and freed
automatically
![Page 18: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/18.jpg)
At function return the stack is popped
![Page 19: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/19.jpg)
public function foo($file1, $file2){ $obj = new Obj(); $data = array(); $data[] = $obj->importAFile($file1); $data[] = $obj->importAFile($file2); return $data; }
![Page 20: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/20.jpg)
Does the memory allocated for $obj get freed after the return?
![Page 21: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/21.jpg)
Yes, it is
![Page 22: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/22.jpg)
And when it isn't?
![Page 23: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/23.jpg)
public function foo($file1, $file2){ $obj = new Obj(); $data = array(); $data[] = $obj->importAFile($file1); $data[] = $obj->importAFile($file2); return $data; }
![Page 24: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/24.jpg)
public function importAFile($file) { //(...) return $this; }
![Page 25: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/25.jpg)
It frees all variables to which there are no references left
![Page 26: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/26.jpg)
Size limited by OS
![Page 27: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/27.jpg)
HEAPS
![Page 28: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/28.jpg)
![Page 29: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/29.jpg)
Fragmented
![Page 30: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/30.jpg)
No limit on memory size*
![Page 31: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/31.jpg)
You have to manage it
![Page 32: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/32.jpg)
Variables can be accessed globally
![Page 33: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/33.jpg)
Extensions Parsed code
Variables
![Page 34: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/34.jpg)
EXTENSIONS
![Page 35: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/35.jpg)
Consume memory
![Page 36: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/36.jpg)
memory_get_usage() profiles the heap
![Page 37: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/37.jpg)
echo memory_get_usage(true);
![Page 38: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/38.jpg)
PHP 5.3 786 432
![Page 39: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/39.jpg)
PHP 5.4 262 144
![Page 40: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/40.jpg)
Upgrade!
![Page 41: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/41.jpg)
Also extensions
![Page 42: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/42.jpg)
PARSED CODE
![Page 43: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/43.jpg)
more code == more memory
![Page 44: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/44.jpg)
more code == more time
![Page 45: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/45.jpg)
but...
![Page 46: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/46.jpg)
OPcache
![Page 47: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/47.jpg)
sudo pecl install zendopcache-7.0.2
![Page 48: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/48.jpg)
Substitute for APC
![Page 49: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/49.jpg)
Stores precompiled script bytecode
in shared memory
![Page 50: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/50.jpg)
![Page 51: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/51.jpg)
Difference ab -n 10000 -c 20
![Page 52: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/52.jpg)
Without cache 1743.994 seconds
![Page 53: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/53.jpg)
OPcache 658.408 seconds
![Page 54: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/54.jpg)
VARIABLES
![Page 55: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/55.jpg)
$startMemory = memory_get_usage(); $array = range(1, 100000); echo memory_get_usage() - $startMemory, ' bytes';
![Page 56: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/56.jpg)
C 100 000 * 8 bytes = 800 000 bytes
![Page 57: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/57.jpg)
PHP 14 649 016 bytes
![Page 58: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/58.jpg)
!?
![Page 59: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/59.jpg)
All variables are represented by one structure
![Page 60: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/60.jpg)
The zval
![Page 61: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/61.jpg)
typedef struct _zval_struct { zvalue_value value; /* variable value */ zend_uint refcount__gc; /* reference counter */ zend_uchar type; /* value type */ zend_uchar is_ref__gc; /* reference flag */ } zval;
![Page 62: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/62.jpg)
typedef union _zvalue_value { long lval; /* long value */ double dval; /* double value */ struct { char *val; int len; /* this will always be set for strings */ } str; /* string (always has length) */ HashTable *ht; /* an array */ zend_object_value obj; /* stores an object store handle, and handlers */ } zvalue_value;
![Page 63: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/63.jpg)
Each variable needs much more memory than in C
![Page 64: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/64.jpg)
| 64 bit | 32 bit --------------------------------------------------- zval | 24 bytes | 16 bytes + cyclic GC info | 8 bytes | 4 bytes + allocation header | 16 bytes | 8 bytes =================================================== zval (value) total | 48 bytes | 28 bytes =================================================== bucket | 72 bytes | 36 bytes + allocation header | 16 bytes | 8 bytes + pointer | 8 bytes | 4 bytes =================================================== bucket (array element) total | 96 bytes | 48 bytes =================================================== total total | 144 bytes | 76 bytes
![Page 65: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/65.jpg)
144 bytes * 100 000 = 1 440 0000
![Page 66: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/66.jpg)
What happened to the rest 249 016 bytes?
![Page 67: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/67.jpg)
Unfilled buckets in C
![Page 68: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/68.jpg)
2^17 = 131 072 131 072 – 100 000 = 31 072 pointers
![Page 69: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/69.jpg)
31 072 pointers * 8 bytes =
248 576 missing bytes
![Page 70: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/70.jpg)
PHP ain’t C
![Page 71: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/71.jpg)
We can use SplFixedArray
![Page 72: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/72.jpg)
That’s 56 bytes per element
![Page 73: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/73.jpg)
SplFixedArray is writting 33 % faster reading 10% faster
![Page 74: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/74.jpg)
Uff, now you know a lot
![Page 75: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/75.jpg)
„Am I a hacker now?”
![Page 76: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/76.jpg)
Not yet, wait a second
![Page 77: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/77.jpg)
Be like a ninja!
![Page 78: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/78.jpg)
Looking for leaks
![Page 79: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/79.jpg)
PHP Fatal Error: Allowed memory size of 8388608 bytes exhausted
![Page 80: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/80.jpg)
ini_set("memory_limit","12M");
![Page 81: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/81.jpg)
ini_set("memory_limit",”512M");
![Page 82: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/82.jpg)
ini_set("memory_limit",”64G");
![Page 83: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/83.jpg)
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried
to allocate 2798048 bytes) in /***/app/http.php on line 6331
![Page 84: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/84.jpg)
That’s the one way
![Page 85: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/85.jpg)
Let’s move to another
![Page 86: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/86.jpg)
Xdebug will help you
![Page 87: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/87.jpg)
Memory needs time
![Page 88: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/88.jpg)
You can debug it step by step
![Page 89: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/89.jpg)
![Page 90: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/90.jpg)
or by xdebug profiler
![Page 91: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/91.jpg)
xdebug.profiler_enable=1 xdebug.profiler_output_dir=/var/logs/profiler
![Page 92: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/92.jpg)
xdebug profiler
![Page 93: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/93.jpg)
Holy moly!
![Page 94: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/94.jpg)
xdebug.trace_output_name
![Page 95: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/95.jpg)
xdebug.collect_params
![Page 96: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/96.jpg)
Default 0.0004 114272 -> str_split() ../trace.php:8 0.0153 117424 -> ret_ord() ../trace.php:10 1 0.0004 114272 -> str_split(string(6)) ../trace.php:8 0.0007 117424 -> ret_ord(string(1)) ../trace.php:10 3 0.0004 114272 -> str_split('Xdebug') ../trace.php:8 0.0007 117424 -> ret_ord('X') ../trace.php:10 4 0.0004 114272 -> str_split('Xdebug') ../trace.php:8 0.0007 117424 -> ret_ord($c = 'X') ../trace.php:10
![Page 97: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/97.jpg)
What's inside?
![Page 98: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/98.jpg)
What's inside?
![Page 99: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/99.jpg)
You can use Webgrind
![Page 100: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/100.jpg)
You can use Webgrind
![Page 101: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/101.jpg)
Analyzer in PHPStorm
![Page 102: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/102.jpg)
![Page 103: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/103.jpg)
![Page 104: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/104.jpg)
After all
![Page 105: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/105.jpg)
Everything consumes memory
![Page 106: PHPConPl 2013 - Allowed memory size of X bytes exhausted](https://reader033.vdocument.in/reader033/viewer/2022052619/555a0070d8b42aa8098b4e2a/html5/thumbnails/106.jpg)
Thank you!