unset memory error in wordpress

A

Anonymous

Guest
Error Allowed memory size of xxxxxxxxxx bytes exhausted (tried to allocate xxxxxxxx bytes)
I am new to php.memory_get_usage()
Initial: 61770528 bytes Final: 65964896 bytes Peak: 71564920 bytes
The short answer i got is that references are merely a way for two variables to share the same value and unset() only deletes a variable, not a value.
So, where to put unset($var); or $var = null
Do not want to increase memory limit
Using wordpress theme with some heavy plugins.Kindly overlook mt poor english :]
got a code but where to place it The change was adding single line of code:

public function run()
{
gc_disable();
 
Whilst it doesn't directly answer your question, it will more likely solve your problem:

You'll need to examine all your code and see where you are loading things that you don't need, be ruthless in getting rid of unneeded arrays, classes, database calls and plugins used.

If you are using an old PHP version, then it would help if you updated it to v7, although this might have implications on your wurdpress installation so do it on a test server, not a live one.
 
Back
Top