Page MenuHomePhabricator

Remove superfluous db freeResult calls
Open, LowPublic

Description

Are all (or at least most) of the various freeResult calls on DB objects superfluous? i.e. Shouldn't code scope take care of them?

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:04 PM
bzimport added a project: Wikimedia-Rdbms.
bzimport set Reference to bz24712.
bzimport added a subscriber: Unknown Object (MLST).
Reedy created this task.Aug 7 2010, 1:59 PM
Reedy added a comment.Aug 7 2010, 2:00 PM

There's 116 or so in phase3 alone, and no doubt, many more in extensions

Reedy added a comment.Aug 9 2010, 8:30 PM

r70686 looks like Chad has done most of them...

Reedy added a comment.Aug 9 2010, 8:57 PM

Search "->freeResult" (14 hits in 4 files)

R:\Programming\SVN\mediawiki\trunk\phase3\includes\db\Database.php (1 hits)

Line 2788: $this->db->freeResult( $this );

R:\Programming\SVN\mediawiki\trunk\phase3\maintenance\convertLinks.inc (3 hits)

Line 60: $dbw->freeResult( $res );
Line 91: $dbw->freeResult( $res );
Line 131: $dbw->freeResult( $res );

R:\Programming\SVN\mediawiki\trunk\phase3\maintenance\convertLinks.php (3 hits)

Line 83: $dbw->freeResult( $res );
Line 114: $dbw->freeResult( $res );
Line 154: $dbw->freeResult( $res );

R:\Programming\SVN\mediawiki\trunk\phase3\maintenance\storage\checkStorage.php (7 hits)

Line 76: $dbr->freeResult( $res );
Line 129: $dbr->freeResult( $res );
Line 162: $dbr->freeResult( $res );
Line 183: $extDb->freeResult( $res );
Line 241: $dbr->freeResult( $res );
Line 279: $dbr->freeResult( $res );
Line 366: $extDb->freeResult( $res );

Domas added a comment.Aug 10 2010, 7:00 AM

are you sure scope takes care of them?

Still valid in 1.21wmf8:

$:andre\> grep -r "\->freeResult" .
./includes/db/DatabaseUtility.php: $this->db->freeResult( $this );
./maintenance/storage/checkStorage.php: $dbr->freeResult( $res );
./maintenance/storage/checkStorage.php: $dbr->freeResult( $res );
./maintenance/storage/checkStorage.php: $dbr->freeResult( $res );
./maintenance/storage/checkStorage.php: $extDb->freeResult( $res );
./maintenance/storage/checkStorage.php: $dbr->freeResult( $res );
./maintenance/storage/checkStorage.php: $dbr->freeResult( $res );
./maintenance/storage/checkStorage.php: $extDb->freeResult( $res );
./maintenance/convertLinks.php: $dbw->freeResult( $res );
./maintenance/convertLinks.php: $dbw->freeResult( $res );
./maintenance/convertLinks.php: $dbw->freeResult( $res );

Krinkle updated the task description. (Show Details)Dec 10 2014, 2:13 PM
Krinkle added a project: Technical-Debt.
Krinkle set Security to None.
Krinkle removed subscribers: Unknown Object (MLST), Krinkle.
Krinkle added a subscriber: Krinkle.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 22 2016, 11:50 PM
demon removed a subscriber: demon.Mar 9 2017, 9:38 PM

Change 498636 had a related patch set uploaded (by D3r1ck01; owner: Derick Alangi):
[mediawiki/core@master] Avoid using calls to freeResults() and allow object go out of scope

https://gerrit.wikimedia.org/r/498636

Change 498636 merged by jenkins-bot:
[mediawiki/core@master] Avoid using calls to freeResults() and allow object go out of scope

https://gerrit.wikimedia.org/r/498636