Index: wp-admin/includes/export.php
===================================================================
--- wp-admin/includes/export.php	(revision 10020)
+++ wp-admin/includes/export.php	(working copy)
@@ -30,6 +30,8 @@
 
 $filename = 'wordpress.' . date('Y-m-d') . '.xml';
 
+set_time_limit( 0 );
+
 header('Content-Description: File Transfer');
 header("Content-Disposition: attachment; filename=$filename");
 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
@@ -187,7 +189,7 @@
  *
  * @since unknown
  */
-function wxr_post_taxonomy() {
+function wxr_post_taxonomy() {    
 	$categories = get_the_category();
 	$tags = get_the_tags();
 	$the_list = '';
@@ -262,6 +264,13 @@
 		$wp_query->in_the_loop = true;  // Fake being in the loop.
 		// fetch 20 posts at a time rather than loading the entire table into memory
 		while ( $next_posts = array_splice($post_ids, 0, 20) ) {
+
+            // reset time limit
+            set_time_limit( 0 );
+            // unset wpdb->queries as this is growing with each query.
+            unset($wpdb->queries);
+            $wpdb->queries=array();
+
 			$where = "WHERE ID IN (".join(',', $next_posts).")";
 			$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
 				foreach ($posts as $post) {
@@ -325,7 +334,17 @@
 </wp:comment>
 <?php } } ?>
 	</item>
-<?php } } } ?>
+<?php
+          // free some memory 
+          unset( $comments );
+          unset( $postmeta );
+          unset( $post );
+}
+          // flush the collected data to the browser      
+          flush();
+          ob_flush();
+          unset( $posts );
+} } ?>
 </channel>
 </rss>
 <?php
