What method or tool can be used to check out the memory occupied by all PHP variables or objects?

in fact, my problem comes from here:

Allowed memory size of 536870912 bytes exhausted (tried to allocate 12288 bytes) 

I think 512m is already very large. If it exceeds this size, there must be something wrong with the program, but the first thought of using breakpoint printing and debugging from top to bottom is too slow to locate which variable or object takes up too much memory at once. Can the request XDEBUG be realized?
or is there any other way to be faster?

Menu