Skip to content

Commit 038932f

Browse files
authored
Merge pull request #19 from jacqueskang/issue-16-memory-leak
bugfix #16 memory leak
2 parents 8925593 + 44fe31a commit 038932f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/JKang.IpcServiceFramework.Client/IpcServiceClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace JKang.IpcServiceFramework
1111
public class IpcServiceClient<TInterface>
1212
where TInterface : class
1313
{
14+
private static readonly ProxyGenerator _proxyGenerator = new ProxyGenerator();
1415
private readonly string _pipeName;
1516
private readonly IIpcMessageSerializer _serializer;
1617
private readonly IValueConverter _converter;
@@ -77,8 +78,7 @@ private static IpcRequest GetRequest(Expression exp, MyInterceptor interceptor)
7778
throw new ArgumentException("Only support calling method, ex: x => x.GetData(a, b)");
7879
}
7980

80-
var proxyGenerator = new ProxyGenerator();
81-
TInterface proxy = proxyGenerator.CreateInterfaceProxyWithoutTarget<TInterface>(interceptor);
81+
TInterface proxy = _proxyGenerator.CreateInterfaceProxyWithoutTarget<TInterface>(interceptor);
8282
Delegate @delegate = lamdaExp.Compile();
8383
@delegate.DynamicInvoke(proxy);
8484

0 commit comments

Comments
 (0)