Open chadcampbell opened 5 years ago
Hi @chadcampbell ,
ServiceProvider is public, so you can dispose it if you want as a workaround.
Regarding implementing IDisposable
for the ODataQuery<T>
to dispose ServiceProvider: I need some time to investigate if it really needed and find the best approach to do that. IQuerable
implementing IDisposable
is somthing uncommon.
So keeping this issue open for now.
Also memory leak and CPU usage spike is not the same, so could you please provide some details about how you identified an issue. If you have some sample code to reproduce it would be great.
@IharYakimush Thank you for reviewing. I mistakenly said CPU usage spike.
Hello,
The
OData
Linq Extension has a memory leak. AServiceContainer
object is getting created, however, it's never disposed. This causes CPU usage to spike over time.I created a fix. I wanted to submit a pull request, however, I was unable to do so on this repo. The changes I made are limited. It would be super helpful if these changes could be integrated and a new NuGet package get published. The changes are in two files:
Community.Data.OData.Linq/ODataQuery.cs
Added
IDisposable
interface to the class.public class ODataQuery<T> : IQueryable<T>, IDisposable
Implemented the
Dispose
method.Community.Data.OData.Linq.xTests
Added test of
Dispose
methodAdded
TestItem
class for testing needs