Hey,

I seem to be getting a fatal memory size error on almost all the pages (frontpage, a node page. It seems to appear on all themes and in all diffrent kind of setups (diffrent sites with diffrent modules - the same error occurs). Maby it has something to do with the memory leaked posted as an issue : http://drupal.org/node/229386.

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 281934 bytes) in /home/bojhan01/domains/bojhan.com/public_html/drupal6/modules/devel/devel.module on line 1299

Regards,

Bojhan

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DaimonteD’s picture

I'm getting a similar error, but only when Theme Developer is enabled:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 1450427 bytes) in C:\xampp\htdocs\drupal\includes\common.inc on line 2275

astra’s picture

With Drupal 6.1 and Devel 6.x-1.6 I also got a similar error

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 289592 bytes)

Web server Apache/1.3.41 (Unix) PHP/5.2.5

nickgs’s picture

I was simply trying to get the theme information for a view I am configuring and was experiencing this error. What I did to fix this problem is simply comment out all the code in the _devel_print_object function. Obviously this is NOT a solution but a little hack just keep my workflow going... :)

I spend a couple of minutes in thought about what can be going and I am not sold that it is in this function. Try simply doing a print_r on the first parameter in this function ($obj) with everything else commented out. This is generating the same memory error. It seems whatever is populating this array is going out of control. Making the recursive "magic" just impossible to complete.

Crell’s picture

Component: devel » devel_themer

I am getting this as well. The problem is that the $output variable is being built as one ginormous value. On a page that has large data structures, such as a View, it is going to be an enormous amount of code that gets saved into that string, which is going to kill the memory limit as $output just gets ginormous. For me, that seems to be happening on every single View, because, well, View objects are big.

It also happens only when devel_themer is enabled, so I think that's the root cause. Refiling. I'm sure moshe will refile it back if I'm wrong. :-)

I think the solution has to be to break up $output and pull it in via AHAH calls as needed. Otherwise, the lookup data for it is just going to be too big.

moshe weitzman’s picture

I'm not sure which $output we mean here. But anyway, how to AHAH this? This is information about the page render and is gone after the completes. There seems to be no benefit in persisting it.

Crell’s picture

Hrm. Good point. However, we do need to find some way to break it up. As is, it's a fatal memory leak on any site with Views. :-)

The code in question is _devel_print_object(). See line 1351 in the 1.7 release. That line serializes a data structure and builds up a large $output variable. That data structure is frequently a $views object, with all of its various child objects, with some recursion going on in there as well. That, for me, always ends up blowing the memory limit no matter how high I set it.

Do we actually need the entirety of all of those data structures? Could they be pruned? (I'm not actually sure what is happening in there, so I can't say. :-) )

moshe weitzman’s picture

Status: Active » Postponed (maintainer needs more info)

Aha. I actually don't use that code branch. If look at devel_themer_catch_function(), you see that if you have krumo, you use its code here. krumo is terrificaly useful for lots of devel stuff. Could folks install it and see if the errors go away. The README has instructions.

moshe weitzman’s picture

Also, devel_print_object() is the work of jjeff and a little dvessel. If it needs work, perhaps one of them can help.

Yes, we can and should prune some large variables from there I think.

ansorg’s picture

after installing krumo I don't get the OOM error with views anymore. thanks for hinting to krumo as a workaround.

edward.peters’s picture

Status: Postponed (maintainer needs more info) » Active

I have had the same problem. Krumo is a bit beyond me as a non-developer (I need the Theme Developer module for theming) so I used the workaround in #3 and the memory errors disappeared.

Pedro Lozano’s picture

FileSize
777 bytes

Maybe this fix the issues.

perandre’s picture

I experienced the same issue with the white screen (of death...), so I just removed the devel-folder...not too clever. Now, I still get the white page, but no error in the php error log! And I can't access any page. What to do?

Update:
After a couple of server reboots, I get access to all pages. Before this, I tried to clean out devel-releated stuff in the db. Now, if I try to install the module again, I get all kinds of errors on my pages...exactly what can I do to remove all traces of the module, so that I can start fresh? (I can't uninstall it the proper way).

jjeff’s picture

Status: Active » Needs review
FileSize
1.6 KB

This patch limits recursion depth on the devel_print_object() function to 9 levels. Anything over that will output an error.

Please test this out and see if it fixes the problem.

perandre’s picture

Thanks for the patch!

I've never applied a patch before... When I tried, I got this error message:

Hunk #1 succeeded at 1263 (offset 35 lines).
Hunk #2 FAILED at 1337.
1 out of 2 hunks FAILED -- saving rejects to file devel.module.rej

...and my screen is still blank. That might not have been the case if I was able to apply the patch correctly, though.

moshe weitzman’s picture

this patch did not help in my quick testing ... i committed a change to just refuse to print out a Views object so thats our workaround for the moment. Help wanted .. .also remember that krumo users do not hit this troublesome function and still get full visibility into the Views object.

Pedro Lozano’s picture

which one of the 2 patches? did you also tried the one I submitted?

moshe weitzman’s picture

I tried both, but only quickly. Perhaps someone else can verify that yours works or does not.

Steve Dondley’s picture

pl2's patch in comment #11 got rid of the memory problem. I have not tested enough to know if it has any bad side effects.

coderintherye’s picture

I was still experiencing the same error. I couldn't get into the Modules Administration to uninstall the devel module (just got white screen with lots of code) generating the error so I just deleted the folder for the devel module and that has seemed to fix the problem.

I haven't tried the patch, but I had just downloaded the latest 6.x beta from the Modules download section, so maybe this patch needs to be applied to what's available on the modules page? Sorry, not sure I'm fairly new to Drupal still.

moshe weitzman’s picture

Version: 6.x-1.6 » 6.x-1.x-dev
Priority: Critical » Normal
Status: Needs review » Active

Still looking for proper fix, or confirmation of pl2's patch.

dergachev’s picture

Hi guys, just got this error:
PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 43 bytes) in /home/alex/projects/drupal/test1/sites/all/modules/devel/krumo/class.krumo.php on line 788

And upon disabling krumo, I get this error:
PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 770827 bytes) in /home/alex/projects/drupal/test1/includes/common.inc on line 2275

However, disabling theme developer makes this go away. (I haven't applied any of the above patches)

moshe weitzman’s picture

Status: Active » Fixed

krumo is now part of devel, so we avoid this error. please reopen as needed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

darumaki’s picture

I get this error in includes/theme.inc on line 57 and have no devl modules, I just sneezed and
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 35 bytes)

there's plenty of memory size so not sure why it would do this.

dayre’s picture

In 6.2, this is the drupal_to_js function() which has recursive calls. I had a similar out of memory error due to recursion in an object graph that had the drupal_to_js function spinning to exhaustion. Check your object and try to eliminate circular references.