Support » Plugins » update_options causing a fatal error…

  • I am calling update_options with a medium sized array (around 30k I guess) however I keep getting

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 274388 bytes) in /usr/www/users/username/ on line 48

    I have debugged my code and identified that the line update_option below is causing the problem.

    $cache = array(serialize($result), "0.4.5");
    update_option( 'widget_lwfcl-cache', $cache );

    $result an array of strings which is 30k long. 0.4.5 is the version and stored as the second element of the array. This code results in the error shown above.

    Now, if I replace the code above with

    $cache = array("", "0.4.5");
    update_option( 'widget_lwfcl-cache', $cache );

    (correct me if wrong, but this should be 5 bytes long?)

    I get EXACTLY the same error message, the same number of bytes exhausted and tried to allocate.

    So what’s going on here? Why did it just suddenly stop working. I have checked phpinfo and I have 32M to play with (as indicated in the error message), but I do not have access to php.ini and ini_set is disabled I believe. How can I fix this, or is my data just too large?


Viewing 3 replies - 1 through 3 (of 3 total)
  • I also just tried compressing the data, but still does not work. If I comment out the cal to update_option the script runs fine (apart from not saving the data… which is kind of essential).

    Any ideas?


    OK, the error is being caused by:

    function wp_cache_set($key, $data, $flag = '', $expire = 0) {
    	global $wp_object_cache;
    	$data = unserialize(serialize($data));
    	return $wp_object_cache->set($key, $data, $flag, $expire);

    from cache.php. Why serialise the data only to unserialise it immediately after? This is the line that is bombing out for me.

    How do I fix it?


    I just tried upgrading to WordPress 2.5, no error message, just bombs out. In the widgets page, the sidebar is abruptly cut off with %BEGIN_TITLE%%END_TITLE%.

    Anyone please offer any help on this???

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘update_options causing a fatal error…’ is closed to new replies.