diff -urp includes/form.inc includes/form.inc
--- includes/form.inc	2007-12-06 20:39:50.000000000 +0100
+++ includes/form.inc	2007-12-06 20:40:05.000000000 +0100
@@ -1786,6 +1786,7 @@ function theme_checkbox($element) {
   $checkbox .= 'id="'. $element['#id'] .'" ' ;
   $checkbox .= 'value="'. $element['#return_value'] .'" ';
   $checkbox .= $element['#value'] ? ' checked="checked" ' : ' ';
+  $checkbox .= 'onclick="'. $element['#onclick'] .'" ';
   $checkbox .= drupal_attributes($element['#attributes']) .' />';
 
   if (!is_null($element['#title'])) {
diff -urp modules/system/system.admin.inc modules/system/system.admin.inc
--- modules/system/system.admin.inc	2007-12-06 20:39:50.000000000 +0100
+++ modules/system/system.admin.inc	2007-12-06 22:30:30.000000000 +0100
@@ -566,6 +566,7 @@ function _system_is_incompatible(&$incom
  *   The form array.
  */
 function system_modules($form_state = array()) {
+  drupal_add_js(drupal_get_path('module', 'system').'/memorywarn.js');
   drupal_rebuild_theme_registry();
   node_types_rebuild();
   menu_rebuild();
@@ -608,6 +609,10 @@ function system_modules($form_state = ar
     $form['name'][$filename] = array('#value' => $file->info['name']);
     $form['version'][$filename] = array('#value' => $file->info['version']);
     $form['description'][$filename] = array('#value' => t($file->info['description']));
+    // the memory setting is optional so we have to check that it's existing
+    if (isset($file->info['memory'])) {
+      $form['memory'][$filename] = array('#value' => $file->info['memory']);
+    }
     $options[$filename] = '';
     // Ensure this module is compatible with this version of core and php.
     if (_system_is_incompatible($incompatible_core, $files, $file) || _system_is_incompatible($incompatible_php, $files, $file)) {
@@ -1690,6 +1695,21 @@ function system_sql() {
 }
 
 /**
+ * Returns information about the memory usage
+ */
+function system_memory_info() {
+  $meminf = array();
+  $meminf['in_use'] = round(memory_get_usage()/1024/1024, 2);
+  $meminf['limit']  = floatval(ini_get('memory_limit'));
+  if ($meminf['limit'] - $meminf['in_use'] < 5.0) {
+    $meminf['state'] = 'error';
+  } else {
+    $meminf['state'] = 'status';
+  }
+  return $meminf;
+}
+
+/**
  * Default page callback for batches.
  */
 function system_batch_page() {
@@ -1929,13 +1949,21 @@ function theme_system_modules($form) {
   }
   ksort($packages);
 
-  // Display packages.
   $output = '';
+  // Display memory usage
+  $meminf = system_memory_info();
+  $output .= '<div id="meminf" class="messages '.$meminf['state'].'">'.t('Memory usage: @mem_in_use of @mem_limit MB.', array('@mem_in_use' => $meminf['in_use'], '@mem_limit' => $meminf['limit'])).'</div>';
+
+  // Display packages.
   foreach ($packages as $package => $modules) {
     $rows = array();
     foreach ($modules as $key => $module) {
       $row = array();
       $description = drupal_render($form['description'][$key]);
+      $memory_info = '';
+      if (isset($form['memory'][$key])) {
+        $memory_info = t('Estimated memory required: @memory MB', array('@memory' => $form['memory'][$key]['#value']));
+      }
       if (isset($form['status']['#incompatible_modules_core'][$key])) {
         unset($form['status'][$key]);
         $status = theme('image', 'misc/watchdog-error.png', t('incompatible'), t('Incompatible with this version of Drupal core'));
@@ -1967,7 +1995,7 @@ function theme_system_modules($form) {
       }
 
       $row[] = drupal_render($form['version'][$key]);
-      $row[] = array('data' => $description, 'class' => 'description');
+      $row[] = array('data' => $description, 'class' => 'description', 'title' => $memory_info);
       $rows[] = $row;
     }
     $fieldset = array(
diff -urp modules/system/system.module modules/system/system.module
--- modules/system/system.module	2007-12-06 20:39:50.000000000 +0100
+++ modules/system/system.module	2007-12-06 20:52:43.000000000 +0100
@@ -144,7 +144,7 @@ function system_elements() {
   $type['radios'] = array('#input' => TRUE, '#process' => array('expand_radios'));
   $type['radio'] = array('#input' => TRUE, '#default_value' => NULL, '#process' => array('form_expand_ahah'));
   $type['checkboxes'] = array('#input' => TRUE, '#process' => array('expand_checkboxes'), '#tree' => TRUE);
-  $type['checkbox'] = array('#input' => TRUE, '#return_value' => 1, '#process' => array('form_expand_ahah'));
+  $type['checkbox'] = array('#input' => TRUE, '#return_value' => 1, '#process' => array('form_expand_ahah'), '#onclick' => 'updateMem(this)');
   $type['select'] = array('#input' => TRUE, '#size' => 0, '#multiple' => FALSE, '#process' => array('form_expand_ahah'));
   $type['weight'] = array('#input' => TRUE, '#delta' => 10, '#default_value' => 0, '#process' => array('process_weight', 'form_expand_ahah'));
   $type['date'] = array('#input' => TRUE, '#process' => array('expand_date'), '#element_validate' => array('date_validate'));
