unset memory error in wordpress

Links for php scripts

Moderators: egami, macek, gesf

Post Reply
navnitm
New php-forum User
New php-forum User
Posts: 2
Joined: Sun Aug 27, 2017 3:12 am

Mon Aug 28, 2017 8:50 pm

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();

User avatar
hyper
php-forum Fan User
php-forum Fan User
Posts: 648
Joined: Mon Feb 22, 2016 5:52 pm

Tue Aug 29, 2017 8:11 am

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.

Post Reply