Search code examples
drupaldrupal-7

Why does Drupal Create extra unused objects on page loads


I'm a bit confused about something Drupal 7 is currently doing. whenever I log in as admin, the UserController->attachLoad() method in user.module runs and then loads all users from the database. I can see that all the users have been loaded as php objects at the initial login, and it seems really unecessary and wasteful to load so many things that, to my knowledge, are not yet needed. Any ideas on how to stop this from happening will be much appreciated. :)


Solution

  • I think what is happening is that you are using the devel module. One of the features of this module is that it creates a list of sample user accounts that you can switch to in order to test the site under different user contexts.

    If you disable the Devel module, you will likely see the UserController->attachLoad() called only once and only with one account (yours).

    And I might add that the subject and your question don't appear to be related to each other.