Revision: 234b21d953b5
Branch: default
Author: Joe Shook <
joes...@gmail.com>
Date: Wed Oct 1 01:17:20 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=234b21d953b5&repo=net35
Modified:
/csharp/gateway/smtpAgent/ConfigService.cs
/csharp/unittests/smtpAgent.integration/smtpAgent.integration.tests.csproj
=======================================
--- /csharp/gateway/smtpAgent/ConfigService.cs Thu Dec 5 06:22:14 2013 UTC
+++ /csharp/gateway/smtpAgent/ConfigService.cs Wed Oct 1 01:17:20 2014 UTC
@@ -97,18 +97,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;
}
}
=======================================
---
/csharp/unittests/smtpAgent.integration/smtpAgent.integration.tests.csproj
Thu Jun 19 04:41:34 2014 UTC
+++
/csharp/unittests/smtpAgent.integration/smtpAgent.integration.tests.csproj
Wed Oct 1 01:17:20 2014 UTC
@@ -3,7 +3,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)'
== '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.21022</ProductVersion>
+ <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{CBA6088A-9425-4948-B046-0E0EABF07E5D}</ProjectGuid>
<OutputType>Library</OutputType>
@@ -48,11 +48,11 @@
<Reference Include="System.Xml" />
<Reference Include="xunit, Version=1.6.1.1521, Culture=neutral,
PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
-
<HintPath>..\..\..\..\nhin-d35\csharp\external\xunit\xunit.dll</HintPath>
+ <HintPath>..\..\external\xunit\xunit.dll</HintPath>
</Reference>
<Reference Include="xunit.extensions, Version=1.6.1.1521,
Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c,
processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
-
<HintPath>..\..\..\..\nhin-d35\csharp\external\xunit\xunit.extensions.dll</HintPath>
+ <HintPath>..\..\external\xunit\xunit.extensions.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>