Skip to content

Commit

Permalink
Add a note about IX-Async in client eval (#2855)
Browse files Browse the repository at this point in the history
Resolves #2115
  • Loading branch information
smitpatel committed Nov 10, 2020
1 parent 18482b0 commit eb6b62c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion entity-framework/core/querying/client-eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Client vs. Server Evaluation - EF Core
description: Client and server evaluation of queries with Entity Framework Core
author: smitpatel
ms.date: 10/03/2019
ms.date: 11/09/2020
uid: core/querying/client-eval
---
# Client vs. Server Evaluation
Expand Down Expand Up @@ -40,6 +40,9 @@ In such cases, you can explicitly opt into client evaluation by calling methods

[!code-csharp[Main](../../../samples/core/Querying/ClientEvaluation/Program.cs#ExplicitClientEvaluation)]

> [!TIP]
> If you are using `AsAsyncEnumerable` and want to compose the query further on client side then you can use [System.Interactive.Async](https://www.nuget.org/packages/System.Interactive.Async/) library which defines operators for async enumerables. For more information, see [client side linq operators](xref:core/miscellaneous/async#client-side-async-linq-operators).
## Potential memory leak in client evaluation

Since query translation and compilation are expensive, EF Core caches the compiled query plan. The cached delegate may use client code while doing client evaluation of top-level projection. EF Core generates parameters for the client-evaluated parts of the tree and reuses the query plan by replacing the parameter values. But certain constants in the expression tree can't be converted into parameters. If the cached delegate contains such constants, then those objects can't be garbage collected since they're still being referenced. If such an object contains a DbContext or other services in it, then it could cause the memory usage of the app to grow over time. This behavior is generally a sign of a memory leak. EF Core throws an exception whenever it comes across constants of a type that can't be mapped using current database provider. Common causes and their solutions are as follows:
Expand Down

0 comments on commit eb6b62c

Please sign in to comment.