-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory Leak 8.2.2 when using Odata to communicate with Business Central #1371
Comments
Did you notice this as a regression from a previous version, or do you know if the same issue occurs in earlier versions? |
@MikkelGlerup the most common reason for memory issues in the OData client is having entity tracking enabled. This issue is exacerbated if you are also creating a new instance of your data service context ( |
We had the same problem running 7.2, however I didn't look more into how much, since I read that 8.0 had memory optimization and decided to update |
how do I disable entity tracking in this case? unfortunately we don't create new instances of our data service contexts. This was my first thought, and to be sure I double checked just now. |
@MikkelGlerup If you're using a single instance of the DataServiceContext throughout your app, and your process is long-running, and client-tracking is enabled, then it's possible that the DataServiceContext's entity tracker can grow in size over time (e.g. each time it fetches entities from the server, if those entities will be stored and cached on the client side in the local entity tracker if they don't already exist in the tracker). It's hard to tell whether that's what your service is facing without having additional information such as screenshot of the memory profiler's snapshot of objects in memory, or a repro project that demonstrates the issue. It would also be good to force garbage collection and see if memory use goes down, or if it says up even after full GC. That said, you could disable entity tracking and see if that helps: new MyDataServiceContextClass
{
MergeOption = MergeOption.NoTracking
} PS: If this fixes the problem we should have an article about this in our performance guidelines docs: MicrosoftDocs/OData-docs#317 |
@habbes This finally is run at the end of every operation. I'd love to use
However with the way Business Central uses Odata it is impossible. You'd get errors telling you how the object you're saving has already changed if it is not tracked.
I've already tried testing this through the code snippet I screenshot first, and nothing changed, well except the memory which rose 😄 |
Our project is using .NET8
Odata 8.2.2
When running our project, each time the code does retrieves or saves data in Business Central through Odata the memory usage goes up without ever coming down:
looking at memory heap most of it not all memory is being taken by Odata.
The text was updated successfully, but these errors were encountered: