free and unset DB_DataObjects after we're done with them

darcs-hash:20080906015501-84dde-e787962b9805759224389dd42a211dfa21da3473.gz
This commit is contained in:
Evan Prodromou 2008-09-05 21:55:01 -04:00
parent 9e8ae6a1e7
commit 0c71340c9f
5 changed files with 34 additions and 0 deletions

View File

@ -92,6 +92,7 @@ function jabber_send_notice($to, $notice) {
$msg = jabber_format_notice($profile, $notice); $msg = jabber_format_notice($profile, $notice);
$entry = jabber_format_entry($profile, $notice); $entry = jabber_format_entry($profile, $notice);
$conn->message($to, $msg, 'chat', NULL, $entry); $conn->message($to, $msg, 'chat', NULL, $entry);
$profile->free();
return true; return true;
} }
@ -204,6 +205,9 @@ function jabber_broadcast_notice($notice) {
$msg = jabber_format_notice($profile, $notice); $msg = jabber_format_notice($profile, $notice);
$entry = jabber_format_entry($profile, $notice); $entry = jabber_format_entry($profile, $notice);
$profile->free();
unset($profile);
$sent_to = array(); $sent_to = array();
$conn = jabber_connect(); $conn = jabber_connect();
@ -225,6 +229,8 @@ function jabber_broadcast_notice($notice) {
$sent_to[$user->id] = 1; $sent_to[$user->id] = 1;
} }
$user->free();
# Now, get users subscribed to this profile # Now, get users subscribed to this profile
$user = new User(); $user = new User();
@ -245,6 +251,8 @@ function jabber_broadcast_notice($notice) {
} }
} }
$user->free();
return true; return true;
} }
@ -280,6 +288,7 @@ function jabber_public_notice($notice) {
$conn->message($address, $msg, 'chat', NULL, $entry); $conn->message($address, $msg, 'chat', NULL, $entry);
$conn->processTime(0); $conn->processTime(0);
} }
$profile->free();
} }
return true; return true;

View File

@ -132,6 +132,9 @@ function omb_broadcast_remote_subscribers($notice) {
} }
} }
$rp->free();
unset($rp);
return true; return true;
} }
@ -160,6 +163,9 @@ function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret) {
$notice->id))); $notice->id)));
$req->set_parameter('omb_notice_license', common_config('license', 'url')); $req->set_parameter('omb_notice_license', common_config('license', 'url'));
$user->free();
unset($user);
$req->sign_request(omb_hmac_sha1(), $con, $token); $req->sign_request(omb_hmac_sha1(), $con, $token);
# We re-use this tool's fetcher, since it's pretty good # We re-use this tool's fetcher, since it's pretty good

View File

@ -87,11 +87,15 @@ class QueueHandler extends Daemon {
continue; continue;
} }
$this->log(LOG_INFO, 'finished broadcasting notice ID = ' . $notice->id); $this->log(LOG_INFO, 'finished broadcasting notice ID = ' . $notice->id);
$notice->free();
unset($notice);
$notice = NULL; $notice = NULL;
} else { } else {
$this->log(LOG_WARNING, 'queue item for notice that does not exist'); $this->log(LOG_WARNING, 'queue item for notice that does not exist');
} }
$qi->delete(); $qi->delete();
$qi->free();
unset($qi);
$this->idle(0); $this->idle(0);
} else { } else {
$this->clear_old_claims(); $this->clear_old_claims();
@ -115,6 +119,8 @@ class QueueHandler extends Daemon {
$qi->transport = $this->transport(); $qi->transport = $this->transport();
$qi->whereAdd('now() - claimed > '.CLAIM_TIMEOUT); $qi->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
$qi->update(DB_DATAOBJECT_WHEREADD_ONLY); $qi->update(DB_DATAOBJECT_WHEREADD_ONLY);
$qi->free();
unset($qi);
} }
function log($level, $msg) { function log($level, $msg) {

View File

@ -76,6 +76,10 @@ class XmppConfirmHandler extends XmppQueueHandler {
continue; continue;
} }
} }
$user->free();
unset($user);
$confirm->free();
unset($confirm);
$this->idle(0); $this->idle(0);
} else { } else {
# $this->clear_old_confirm_claims(); # $this->clear_old_confirm_claims();
@ -119,6 +123,8 @@ class XmppConfirmHandler extends XmppQueueHandler {
$confirm->claimed = NULL; $confirm->claimed = NULL;
$confirm->whereAdd('now() - claimed > '.CLAIM_TIMEOUT); $confirm->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
$confirm->update(DB_DATAOBJECT_WHEREADD_ONLY); $confirm->update(DB_DATAOBJECT_WHEREADD_ONLY);
$confirm->free();
unset($confirm);
} }
} }

View File

@ -145,6 +145,9 @@ class XMPPDaemon extends Daemon {
} }
$this->add_notice($user, $pl); $this->add_notice($user, $pl);
} }
$user->free();
unset($user);
} }
function is_self($from) { function is_self($from) {
@ -281,6 +284,8 @@ class XMPPDaemon extends Daemon {
common_broadcast_notice($notice); common_broadcast_notice($notice);
$this->log(LOG_INFO, $this->log(LOG_INFO,
'Added notice ' . $notice->id . ' from user ' . $user->nickname); 'Added notice ' . $notice->id . ' from user ' . $user->nickname);
$notice->free();
unset($notice);
} }
function handle_presence(&$pl) { function handle_presence(&$pl) {
@ -310,6 +315,8 @@ class XMPPDaemon extends Daemon {
' status from presence.'); ' status from presence.');
$this->add_notice($user, $pl); $this->add_notice($user, $pl);
} }
$user->free();
unset($user);
} }
break; break;
} }