Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When trying to add a Link (7.x-1.1) field to a content type with multiple fields I receive the following:
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 78 bytes) in /home/xxx/public_html/sites/all/modules/token/token.pages.inc on line 71
Comments
Comment #1
moonray CreditAttribution: moonray commentedWhen trying to 'Browse available tokens' on /admin/config/people/accounts
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 79 bytes) in ../sites/all/modules/token/token.pages.inc on line 228
That's a crazy amount of memory required.
Comment #2
penyaskitoSame issue in some random page that lists the table of available tokens.
Comment #3
penyaskitoIssue is at theme_token_tree() if we have a lot of items.
What approach could we take on this? Ajax loading of tokens? Pagination?
Comment #4
moonray CreditAttribution: moonray commentedSee #1334456: Enable ajax on-demand loading of sub-trees in the Token help for long-standing best approach.
Comment #5
nigelheinsius CreditAttribution: nigelheinsius commentedI believe I was having memory problems on my "admin/structure/types/manage/content-type-xx" page. I use Automatic Nodetitles which leverages token to set custom page titles and the settings for this are on the edit content type page. The fix? I installed the "token_tweaks" module to limit the depth of the tokens built for the token tree for Automatic Nodetitles from 4 to 2 and my problem was solved.
Comment #6
Renee S CreditAttribution: Renee S commentednigelheinsius: This solves the problem... but it means you can't see what tokens you have available. I consider that a huge deal.
Comment #7
mvonfrie CreditAttribution: mvonfrie commentedI have a similar issue but at another place:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 bytes) in /var/www/drupal7/sites/all/modules/token/token.tokens.inc on line 895
This is the
[custom:hash:*] dynamic token
block inside the token_tokens() implementation. The strange thing is, that it only occurs when the user is logged in and doesn't have a certain permission. I want to create an "editor" role on my side. When this role has all permissions (as administrator) I can login with the user, when I remove permissions it crashes. I haven't found out yet which permission is causing it.Update:
This is caused by the Administer Organic groups permission.
Comment #8
Renee S CreditAttribution: Renee S commentedmvonrie: It's likely that tokens are being added by OG that are pushing your site over the edge. You can either give it more memory (sigh) or use the Token Tweaks module to cut down on the token depths being displayed on any given form.
Comment #9
mvonfrie CreditAttribution: mvonfrie commentedRenee: Thanks but it doesn't help. I've increased memory from 128MB to 256 MB and set token depth to down to 1 with Token Tweaks. Now I get no response from the server and not even an entry in PHP error log.
Comment #10
thuzyanth CreditAttribution: thuzyanth commentedHow to increase Allowed memory size ?
Comment #11
mvonfrie CreditAttribution: mvonfrie commentedI already have increased memory by 100% and more is not possible (shared hosting). Yesterday I talked to some people at DrupalCamp Vienna and for them it seems to be an endless loop.
Comment #12
BassPlaya CreditAttribution: BassPlaya commented@nigelheinsius, yeah man! Awesome! This rocks. I was so fed up with the overload on my site because of this issue and indeed Token Tweaks is a great solution for my PDOException issue here: https://drupal.org/comment/8213899#comment-8213899
before installing this module:
admin/structure/types/manage/my-story-type:
Page execution time was 2114.85 ms. Memory used at: devel_boot()=3.86 MB, devel_shutdown()=73.22 MB, PHP peak=136 MB.
After installing:
Page execution time was 329.83 ms. Memory used at: devel_boot()=3.86 MB, devel_shutdown()=43.62 MB, PHP peak=48.5 MB.
Oh yeah baby!
Kudos!
Comment #13
DamienMcKennaOne way of fixing this might be to use the '#dialog' => TRUE option when loading token_tree, e.g.:
(from #1784874: Token dialog for Pathauto)
The best long term solution will be #1334456: Enable ajax on-demand loading of sub-trees in the Token help. Or fixing the entire contrib realm so that Entity Token isn't used. But I digress.
Until then, I'm marking this as a duplicate of #1334456: Enable ajax on-demand loading of sub-trees in the Token help.
Comment #14
r2coder CreditAttribution: r2coder commentedI am also receiving this error - and reported it here: https://www.drupal.org/node/1282422. Anyone know whether or not #13 fix works.
Comment #15
jaspm2004 CreditAttribution: jaspm2004 commentednigelheinsius: wow man! thanks! i was dealing with this issue since forever...big thanks!
#5 did it for me, i set maximun depth = 2