praeclarum / FuGetGallery

An alternative web UI for browsing nuget packages
https://www.fuget.org
MIT License
683 stars 121 forks source link

Don't keep the Stream around for longer than necessary #120

Closed MatthewSteeples closed 3 years ago

MatthewSteeples commented 3 years ago

This should hopefully resolve (or at least reduce) the OutOfMemoryExceptions mentioned in #108, #96, and #48

The summary is

I've tested it locally and it seems to load fine, but obviously this issue was only intermittent so not easily reproducible.

If you are considering accepting this PR before the end of October, it would be great if you could apply the label hacktoberfest-accepted as explained here, but I'm not going to be offended if not. This has been a great resource for us and I'm glad I can give back to it

praeclarum commented 3 years ago

Hello, given @loic-sharma's comments, I think the best strategy will be to use temporary files to relieve mem pressure.

I'm a bit worried about losing seekability on the stream, but that might not actually be an issue.

Some investigation or memory profiling may be needed before making changes. My thought is that .NET metadata is taking up the memory. I agree though that it would be nice to get rid of the ref to the zip.