WordPress PHP致命错误:内存不足(分配2097152)(试图分配4096字节)

There are many questions already asked about this error, but I could not find a solution for my situation, so I created a new one where I hope to get answers to two very specific questions:

1. Where from does the number 2097152 come?

In my php.ini I have memory_limit set to 256M, in my wp-config.php I have WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT set to 256M, so I would expect to get errors stating that 268435456 bytes were allocated and exceeded, where from 2097152 comes?

2097152 = 2048K = 2M, I looked through all the files in Apache, PHP and WordPress folders and could not find any of these values used, please help.

2. Why is amount that was tried to allocate (4096) is less than allocated (2097152)?

Could someone please explain, what am I missing here?

You may be using too much memory for your PHP application. Possible cause could be infinite loops, too much data loaded to a variable/array(may be coming from the database) etc. You should not rely on increasing the memory size but rather find what's causing the problem and solve it there.

Use

error_log("Memory Usage: " . (memory_get_usage()/1048576) . " MB");

and place it on specific locations on your code where you suspect that there's a memory leak or seems that causes the problem.