• Resolved Marty

    (@bozzmedia)


    I have not run into any issues with this plugin over the past year, however recently on one of my sites with only a few plugins on a decent server, I get the following console error when viewing the dashboard:

    <b>Fatal error</b>: Allowed memory size of 41943040 bytes exhausted (tried to allocate 32 bytes) in <b>/home/website/public_html/wp-content/plugins/google-analytics-dashboard-for-wp/tools/src/Google/Service/Analytics.php</b> on line <b>1606</b>

    Does not seem to be impacted if I change the # of days or type of stats. I appreciate I could increase the memory, but currently my php memory limit is set to 256M

    thanks for any insight.

    https://wordpress.org/plugins/google-analytics-dashboard-for-wp/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Are you using php.ini to set the 256M limi? You should also try this http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP.

    Another way will be to disable all other plugins and activate one at the time while constantly checking for errors.

    Thread Starter Marty

    (@bozzmedia)

    Thanks for the prompt reply!

    I tried to increase the WP memory limit but had no luck even all the way up to 256. I found deactivating ithemes security helped, rather strange for such a popular plugin to create these memory issues. Can’t seem to track down why the latest version of that plugin would use so much memory. I’ll send them a note. Thanks again.

    Thread Starter Marty

    (@bozzmedia)

    Hi there. I went over to the other plugin’s support and here is my thread:

    https://wordpress.org/support/topic/recent-version-causes-memory-issues

    Maybe there is a specific conflict between these plugins? The site seems to operate fine except for this dashboard widget.

    Since you have that issue after the latest upgrade of that plugin (as you were noting on the above topic), I really think that the issue is not here.

    I’ll drive some memory usage tests on GADWP, just to make sure.

    Thread Starter Marty

    (@bozzmedia)

    Excellent, thank you. I’m stumped on this one.

    Here you go:

    Samples before plugin init and after query completion (it may include additional core actions):

    [06-Mar-2015 16:31:08 UTC] Start:8.25 MB
    
    [06-Mar-2015 16:31:09 UTC] Stop:13.75 MB
    
    [06-Mar-2015 16:31:09 UTC] Start:8.25 MB
    
    [06-Mar-2015 16:31:09 UTC] Stop:14 MB
    
    [06-Mar-2015 16:31:13 UTC] Start:8.25 MB
    
    [06-Mar-2015 16:31:14 UTC] Stop:13.75 MB
    
    [06-Mar-2015 16:31:14 UTC] Start:8.25 MB
    
    [06-Mar-2015 16:31:14 UTC] Stop:14 MB
    
    [06-Mar-2015 16:31:14 UTC] Start:8.25 MB
    
    [06-Mar-2015 16:31:23 UTC] Stop:14 MB
    
    [06-Mar-2015 16:31:26 UTC] Start:8.25 MB
    
    [06-Mar-2015 16:31:28 UTC] Stop:13.75 MB
    
    [06-Mar-2015 16:31:28 UTC] Start:8.25 MB
    
    [06-Mar-2015 16:31:28 UTC] Stop:14.75 MB

    Maximum 6.5 MB, including other core actions, as I was saying.

    Samples at widget init and after query completion:

    [06-Mar-2015 16:36:32 UTC] Start:11.75 MB
    
    [06-Mar-2015 16:36:33 UTC] Stop:13.5 MB
    
    [06-Mar-2015 16:36:38 UTC] Start:11.75 MB
    
    [06-Mar-2015 16:36:40 UTC] Stop:14 MB
    
    [06-Mar-2015 16:36:43 UTC] Start:11.75 MB
    
    [06-Mar-2015 16:36:45 UTC] Stop:14.5 MB
    
    [06-Mar-2015 16:36:47 UTC] Start:11.75 MB
    
    [06-Mar-2015 16:36:49 UTC] Stop:13.75 MB

    Maximum 2.75 MB

    Start is the memory usage before starting the measurement and Stop is the memory usage at measurement point (after storing the result in the database and just before sending the ajax response).

    All measurements were made on a clean WordPress install, using the Last 90 Days interval on an analytics profile of a big website. Cache was also cleared before each sampling process.

    Thread Starter Marty

    (@bozzmedia)

    Very cool. I would love to run this test on my site with the security plugin and GADWP running concurrently. Hopefully this will get sorted in a future ithemes security plugin update. Thanks again for your help.

    I’m using this piece of code:

    $size = memory_get_usage(true);
    $unit=array('B','KB','MB','GB','TB','PB');
    error_log("Start:".@round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]);

    and

    $size = memory_get_usage(true);
    $unit=array('B','KB','MB','GB','TB','PB');
    error_log("Stop:".@round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]);

    A modified version of this function:

    https://php.net/manual/ro/function.memory-get-usage.php#96280

    For proper measurements it does require good knowledge about how WordPress works and a good understanding of plugin’s architecture (the plugin your driving tests on).

    The test was driven on my development and testing platform which has all debugging features enabled and you may also need to add some additional parameters to error_log function in order to properly log things in your PHP error log (it usually depends on your PHP configuration).

    If you’re going to create a function, you can hook it in various places to determine the memory usage of your entire WP installation (almost entire), memory usage for plugins at predefined points and so on.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Memory error in console’ is closed to new replies.