ThreeMammals / Ocelot

.NET API Gateway
https://www.nuget.org/packages/Ocelot
MIT License
8.31k stars 1.63k forks source link

#1839 Operating memory workaround #1840

Closed RaynaldM closed 6 months ago

RaynaldM commented 9 months ago

We've added "using" on some streams to make sure they're properly disposed.

ggnaegi commented 9 months ago

Maybe that could be a solution too: https://github.com/microsoft/Microsoft.IO.RecyclableMemoryStream

raman-m commented 9 months ago

@RaynaldM What about tests?

My dev process rule: "Don't review PR code if no unit tests" 😉

raman-m commented 9 months ago

@ggnaegi In your opinion, could we add some memory loading/consuming benchmarks here?

RaynaldM commented 9 months ago

@RaynaldM What about tests?

My dev process rule: "Don't review PR code if no unit tests" 😉

UT are already present in OutputCacheMiddlewareTestsand in ResponderMiddlewareTests.

raman-m commented 9 months ago

@RaynaldM commented Dec 8, 2023

:ok: I'll look into these tests...

raman-m commented 8 months ago
<<<<<<< 1839-hunting-for-memory-leaks
            var content = Convert.FromBase64String(cached.Body);
            var byteArrayContent = new ByteArrayContent(content);
=======
            var content = new MemoryStream(Convert.FromBase64String(cached.Body));
            var streamContent = new StreamContent(content);
>>>>>>> develop

I've resolved this conflict in favor of changes in feature branch. Hope it is right.

raman-m commented 6 months ago

Is this PR still actual?

raman-m commented 6 months ago

@RaynaldM If you don't mind, I will delete feature branch too. I don't see any goals to keep the branch opened. But GitHub allows to restore it one day.