Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 1.0.8.8 (21 May 2018)

- [#167](https://github.com/StefH/System.Linq.Dynamic.Core/issues/167) - Issue: Memory leak in `ConstantExpressionHelper.cs` +fix

Commits: 65a03284a0...65a03284a0


# 1.0.8.7 (08 May 2018)

- [#156](https://github.com/StefH/System.Linq.Dynamic.Core/pull/156) - Fix parsing config contributed by Jochen Kühner ([jogibear9988](https://github.com/jogibear9988))
Expand Down
2 changes: 1 addition & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
https://github.com/GitTools/GitReleaseNotes

GitReleaseNotes.exe . /OutputFile CHANGELOG.md /Version 1.0.8.7
GitReleaseNotes.exe . /OutputFile CHANGELOG.md /Version 1.0.8.8

GitReleaseNotes.exe . /OutputFile CHANGELOG.md /allTags
19 changes: 19 additions & 0 deletions System.Linq.Dynamic.Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp_net452_EF6", "sr
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_netcore2.0_EF2.0.2_InMemory", "src-console\ConsoleAppEF2.0.2_InMemory\ConsoleApp_netcore2.0_EF2.0.2_InMemory.csproj", "{437473EE-7FBB-4C28-96EC-41E1AEE161F3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MemoryLeakTest167", "src-console\MemoryLeakTest167\MemoryLeakTest167.csproj", "{AD4F83E5-4240-485D-BB5C-F43974F716E4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -269,6 +271,22 @@ Global
{437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Release|x64.Build.0 = Release|Any CPU
{437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Release|x86.ActiveCfg = Release|Any CPU
{437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Release|x86.Build.0 = Release|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Debug|ARM.ActiveCfg = Debug|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Debug|ARM.Build.0 = Debug|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Debug|x64.ActiveCfg = Debug|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Debug|x64.Build.0 = Debug|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Debug|x86.ActiveCfg = Debug|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Debug|x86.Build.0 = Debug|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Release|Any CPU.Build.0 = Release|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Release|ARM.ActiveCfg = Release|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Release|ARM.Build.0 = Release|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Release|x64.ActiveCfg = Release|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Release|x64.Build.0 = Release|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Release|x86.ActiveCfg = Release|Any CPU
{AD4F83E5-4240-485D-BB5C-F43974F716E4}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -287,6 +305,7 @@ Global
{E587974C-19A9-426A-A952-216D5F883EB6} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62}
{5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62}
{437473EE-7FBB-4C28-96EC-41E1AEE161F3} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62}
{AD4F83E5-4240-485D-BB5C-F43974F716E4} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {94C56722-194E-4B8B-BC23-B3F754E89A20}
Expand Down
6 changes: 6 additions & 0 deletions src-console/MemoryLeakTest167/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
58 changes: 58 additions & 0 deletions src-console/MemoryLeakTest167/MemoryLeakTest167.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{AD4F83E5-4240-485D-BB5C-F43974F716E4}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>MemoryLeakTest167</RootNamespace>
<AssemblyName>MemoryLeakTest167</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\System.Linq.Dynamic.Core\System.Linq.Dynamic.Core.csproj">
<Project>{b70cd050-3b9c-406c-85fd-1a26394ec7c8}</Project>
<Name>System.Linq.Dynamic.Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
38 changes: 38 additions & 0 deletions src-console/MemoryLeakTest167/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using System.Linq.Dynamic.Core;
using System.Linq.Expressions;
using System.Threading;

namespace MemoryLeakTest167
{
class Program
{
static void Main(string[] asArgs)
{
RunThreads(8, RawMemoryLeak);
}

private static void RunThreads(int nThreads, Action actThreadStart)
{
for (int i = 0; i < nThreads; i++)
{
Thread thread = new Thread(new ThreadStart(actThreadStart));
thread.Start();
}

while (true)
{
Thread.Sleep(5000);
}
}

private static void RawMemoryLeak()
{
while (true)
{
string sExpr = "1234567890";
LambdaExpression expr = DynamicExpressionParser.ParseLambda(new ParameterExpression[0], typeof(double), sExpr);
}
}
}
}
35 changes: 35 additions & 0 deletions src-console/MemoryLeakTest167/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MemoryLeakTest167")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MemoryLeakTest167")]
[assembly: AssemblyCopyright("Copyright © Stef Heyenrath 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ad4f83e5-4240-485d-bb5c-f43974f716e4")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Dynamic Linq extensions for EntityFramework which adds Async support</Description>
<AssemblyTitle>EntityFramework.DynamicLinq</AssemblyTitle>
<VersionPrefix>1.0.8.7</VersionPrefix>
<VersionPrefix>1.0.8.8</VersionPrefix>
<Authors>Stef Heyenrath</Authors>
<TargetFrameworks>net45;net46</TargetFrameworks>
<DefineConstants>EF</DefineConstants>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Dynamic Linq extensions for Microsoft.EntityFrameworkCore which adds Async support</Description>
<AssemblyTitle>Microsoft.EntityFrameworkCore.DynamicLinq</AssemblyTitle>
<VersionPrefix>1.0.8.7</VersionPrefix>
<VersionPrefix>1.0.8.8</VersionPrefix>
<Authors>Stef Heyenrath</Authors>
<TargetFrameworks>net451;net46;netstandard1.3;netstandard2.0;uap10.0</TargetFrameworks>
<DefineConstants>$(DefineConstants);EFCORE</DefineConstants>
Expand Down
19 changes: 12 additions & 7 deletions src/System.Linq.Dynamic.Core/Parser/ConstantExpressionHelper.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace System.Linq.Dynamic.Core.Parser
{
internal static class ConstantExpressionHelper
{
private static readonly IDictionary<Expression, string> Literals = new ConcurrentDictionary<Expression, string>();
private static readonly ConcurrentDictionary<object, Expression> Expressions = new ConcurrentDictionary<object, Expression>();
private static readonly ConcurrentDictionary<Expression, string> Literals = new ConcurrentDictionary<Expression, string>();

public static bool TryGetText(Expression expresion, out string text)
public static bool TryGetText(Expression expression, out string text)
{
return Literals.TryGetValue(expresion, out text);
return Literals.TryGetValue(expression, out text);
}

public static Expression CreateLiteral(object value, string text)
{
ConstantExpression expresion = Expression.Constant(value);
if (!Expressions.ContainsKey(value))
{
ConstantExpression constantExpression = Expression.Constant(value);

Literals.Add(expresion, text);
return expresion;
Expressions.TryAdd(value, constantExpression);
Literals.TryAdd(constantExpression, text);
}

return Expressions[value];
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<Description>This is a .NETStandard/ .NET Core port of the the Microsoft assembly for the .Net 4.0 Dynamic language functionality.</Description>
<AssemblyTitle>System.Linq.Dynamic.Core</AssemblyTitle>
<VersionPrefix>1.0.8.7</VersionPrefix>
<VersionPrefix>1.0.8.8</VersionPrefix>
<Authors>Microsoft;Scott Guthrie;King Wilder;Nathan Arnott;Stef Heyenrath</Authors>
<TargetFrameworks>net35;net40;net45;net46;uap10.0;netstandard1.3;netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down