The comment below asserts that the following section is now obsolete.

this information is obsolete, it's not necessary to do this anymore! the line
window.onunload = Webfm.eventUnregisterWebfm;
in the js takes care of it.

Ignore this page!
----


To explicitly destroy the event closures to minimize browser memory leaks an unload event needs to fire. Unfortunately the control of the body tag happens in the template. I modified my 5.x garland theme accordingly:

Add this function to template.php:

function phptemplate_unload() {
  if(module_exists('webfm')) {
    $path = $_SERVER['REQUEST_URI'];
    if((strstr($path, 'webfm')) ||
       (strstr($path, 'node') && strstr($path, 'edit')))
      print '  onunload="Webfm.unregisterAllEvents();"';
    }
  }
}

Add the following inside the php tag of the body tag of page.tpl.php:

print phptemplate_unload();

I wish Drupal offered a more elegant way of doing this. My first attempt was to put the 'onunload' event into the javascript but this hung IE.

I'm not the only one to struggle with this. See http://drupal.org/node/57635