You are here

function _fpa_memory_required in Fast Permissions Administration 7.2

Return value

int Approximate number of bytes of ram required to render the permissions form.

2 calls to _fpa_memory_required()
fpa_form_user_admin_permissions_alter in ./fpa.form_alter.inc
Implements hook_form_FORM_ID_alter().
fpa_requirements in ./fpa.install
Implements hook_requirements().

File

./fpa.module, line 177
Main module file for FPA.

Code

function _fpa_memory_required() {
  $permissions_count = count(module_invoke_all('permission'));
  $user_roles_count = count(user_roles());
  $page_ram_required = 9 * 1024 * 1024;

  // Takes ~26kb per row without any checkboxes.
  $permission_row_overhead = 27261.028783658;
  $permissions_ram_required = $permissions_count * $permission_row_overhead;

  // Determined by checking peak ram on permissions page, over several different number of visible roles.
  $bytes_per_checkbox = 18924.508820799;
  $checkboxes_ram_required = $permissions_count * $user_roles_count * $bytes_per_checkbox;
  return (int) ($page_ram_required + $permissions_ram_required + $checkboxes_ram_required);
}