Closed GoogleCodeExporter closed 9 years ago
Original comment by jun...@google.com
on 23 Nov 2011 at 10:42
Another issue about memory leaks:
In CallClient::InitPresence many task objects are instantiated (e.g.
PresenceOutTask and PresencePushTask). It seems that these objects are never
deleted. Isn't this memory leak too?
Original comment by diego.cd...@gmail.com
on 28 Nov 2011 at 3:32
Another issue about memory leaks:
In CallClient::SendChat the stanza (objects from XmlElement class) creted is
deleted:
void CallClient::SendChat(const std::string& to, const std::string msg) {
buzz::XmlElement* stanza = new buzz::XmlElement(buzz::QN_MESSAGE);
stanza->AddAttr(buzz::QN_TO, to);
stanza->AddAttr(buzz::QN_ID, talk_base::CreateRandomString(16));
stanza->AddAttr(buzz::QN_TYPE, "chat");
buzz::XmlElement* body = new buzz::XmlElement(buzz::QN_BODY);
body->SetBodyText(msg);
stanza->AddElement(body);
xmpp_client_->SendStanza(stanza);
delete stanza;
}
But there are a lot of stanzas (objects from XmlElement class) that are created
and are not deleted. e.g. PresenceOutTask::SendDirected (Send and SendProbe are
other examples in this class but this situation occurs all over the code):
XmppReturnStatus
PresenceOutTask::SendDirected(const Jid & j, const Status & s) {
if (GetState() != STATE_INIT && GetState() != STATE_START)
return XMPP_RETURN_BADSTATE;
XmlElement * presence = TranslateStatus(s);
presence->AddAttr(QN_TO, j.Str());
QueueStanza(presence);
return XMPP_RETURN_OK;
}
Isn't this memory leak too?
Original comment by diego.cd...@gmail.com
on 28 Nov 2011 at 3:40
Not all reported spots have leak. I've fixed all real leaks. It'll be in the
next libjingle release. Thanks your reporting those issues.
Original comment by jun...@google.com
on 1 Dec 2011 at 5:17
[deleted comment]
[deleted comment]
Other related leaks of comment #3: MucInviteSendTask::Send and
FriendInviteSendTask::Send. I don't know if the same issue happens in libjingle
core. And only now I noticed a lack of pattern in those task classes: Some of
them have/had this issue while DiscoItemsQueryTask and PresenceOutTask (of
login example. This is a old class that no longer exists:
http://www.google.com/codesearch#9XskYags0aI/trunk/talk/examples/login/presenceo
uttask.h&q=presenceouttask%20package:http://libjingle\.googlecode\.com) have
smart pointers for stanzas:
int DiscoItemsQueryTask::ProcessStart() {
talk_base::scoped_ptr<XmlElement> get(MakeIq(STR_GET, to_, task_id()));
and
private:
XmlElement * TranslateStatus(const Status & s);
scoped_ptr<XmlElement> stanza_;
};
The last code is in PresenceOutTask of login example. Why this difference?
I also would like to know why comment #2 was not considered a leak. Shouldn't
the task classes be deleted? Thanks.
Original comment by diego.cd...@gmail.com
on 11 Dec 2011 at 12:33
I didn't realized that you added more issues after I changed the status to
"accepted". My fix was about everything prior to that point.
In the future, please file new issues if I changed the status of current issue
to "accepted", which is the point where I started working on it.
Thanks for understanding.
Original comment by jun...@google.com
on 11 Dec 2011 at 4:00
Ok Jun, understood, next time I will do it. But someone fixed the issues I
pointed on comment #3 (after you changed to accept). So in comment #7 I wrote
two more points in the code (like I said, I pointed on call example. I don't
know if this problem happens on libjingle core) with the same problem and also
pointed some differences in how stanzas are handled in the code. Finally,
please let me know if comment #2 is a leak or not. Thanks.
Original comment by diego.cd...@gmail.com
on 11 Dec 2011 at 5:08
Issue 284 has been merged into this issue.
Original comment by jun...@google.com
on 10 Feb 2012 at 12:54
Original comment by jun...@google.com
on 26 Mar 2012 at 6:38
Original comment by jun...@google.com
on 26 Mar 2012 at 6:40
Please file new bug in WebRTC issue tracker if you still see leaks.
Original comment by juberti@google.com
on 1 Jun 2013 at 4:43
Original issue reported on code.google.com by
wangqin...@gmail.com
on 22 Nov 2011 at 11:12