Menu

#76 Memory leaks

open
nobody
None
5
2006-04-11
2006-04-11
Kevin
No

I have been using this code for quite some time.
Recently, detected increased memory consumption while
testing in one scenario. If the smtp server
authentication fails at line 9/11 , an smtp exception
gets thrown (correct behaviour). However, the memory
usage keeps increasing when this code is being called
by a windows service. What could be causing this ?

--------------------------------------------
private bool SendEmail (ref MailMessage msg)
{
// Send email
try
{ Smtp openSmtp = null;

//Send email
if (smtpServerInfo.Login.Length < 1 ||
smtpServerInfo.Password.Length < 1)
{
openSmtp = new
Smtp(smtpServerInfo.ServerAddress,Int32.Parse(smtpServerInfo.PortNumber));

}
else
{
openSmtp = new Smtp(smtpServerInfo.ServerAddress,
smtpServerInfo.Login,smtpServerInfo.Password,Int32.Parse(smtpServerInfo.PortNumber));
}

openSmtp.SendMail(msg);

}

return true;
}
catch(SmtpException e)
{
}
----------------------------------

Any help on this is mucho appreciated.

Kevin

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.