From 7d0391a0c5d95890d8fb3e1298f3d375db1f94e2 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Sun, 27 Jul 2008 18:14:59 +0000 Subject: [PATCH] Indeed, this is a ResultWrapper object, so we can iterate over it: no ugly while loops. In fact, we don't even have to bother creating the array. A few quick tests show >100 KB peak memory usage drop even on a quite small RC, a couple dozen items. --- includes/specials/SpecialRecentchanges.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 071854f2c7..c8b430aa67 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -96,22 +96,19 @@ class SpecialRecentChanges extends SpecialPage { $rows = array(); $batch = new LinkBatch; $conds = $this->buildMainQueryConds( $opts ); - $res = $this->doMainQuery( $conds, $opts ); - if( $res === false ){ + $rows = $this->doMainQuery( $conds, $opts ); + if( $rows === false ){ $this->doHeader( $opts ); return; } - while( $row = $res->fetchObject() ){ - $rows[] = $row; + foreach( $rows as $row ) { if ( !$feedFormat ) { // User page and talk links $batch->add( NS_USER, $row->rc_user_text ); $batch->add( NS_USER_TALK, $row->rc_user_text ); } - } - $res->free(); if ( $feedFormat ) { list( $feed, $feedObj ) = $this->getFeedObject( $feedFormat ); @@ -120,7 +117,8 @@ class SpecialRecentChanges extends SpecialPage { $batch->execute(); $this->webOutput( $rows, $opts ); } - + + $rows->free(); } /** -- 2.20.1