Revision: a009e0bc71f3
Branch: default
Author: joeshook
Date: Wed Oct 1 01:19:48 2014 UTC
Log: Issue: 245 "Memory Leak when using AddressManager configuration
and EnableDomainSearch equal to true"
https://code.google.com/p/nhin-d/issues/detail?id=245&sort=-id&colspec=ID%20Project%20Type%20Status%20Priority%20Owner%20Summary#makechanges
Code fix in ConfigService.cs to avoid calling XmlSerializer constructor
more than
one time. Calling XmlSerializer with certain constructors is a known
memory leak.
We do not need to call it more than once. It is now resolved.
https://code.google.com/p/nhin-d/source/detail?r=a009e0bc71f3
Modified:
/csharp/gateway/smtpAgent/ConfigService.cs
=======================================
--- /csharp/gateway/smtpAgent/ConfigService.cs Tue Dec 10 00:36:45 2013 UTC
+++ /csharp/gateway/smtpAgent/ConfigService.cs Wed Oct 1 01:19:48 2014 UTC
@@ -103,18 +103,27 @@
{
return m_settings.AddressManager.CreateAddressManagerClient();
}
+
+ private bool? _enabledDomainSearch;
private bool AddressDomainSearchEnabled(ClientSettings
addressManager)
{
+ if (_enabledDomainSearch.HasValue)
+ {
+ return _enabledDomainSearch.Value;
+ }
if (addressManager.HasSettings)
{
using (XmlNodeReader reader = new
XmlNodeReader(addressManager.Settings))
{
XmlSerializer serializer = new
XmlSerializer(typeof(AddressManagerSettings), new
XmlRootAttribute(addressManager.Settings.LocalName));
AddressManagerSettings addressManagerSettings =
(AddressManagerSettings)serializer.Deserialize(reader);
- return addressManagerSettings.EnableDomainSearch;
+ _enabledDomainSearch =
addressManagerSettings.EnableDomainSearch;
+
+ return _enabledDomainSearch.Value;
}
}
+
return false;
}
}