Skip to content
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

Freeing up memory from ArrayPools #10099

Closed
Petermarcu opened this issue Apr 5, 2018 · 9 comments
Closed

Freeing up memory from ArrayPools #10099

Petermarcu opened this issue Apr 5, 2018 · 9 comments
Labels
area-GC-coreclr tenet-performance Performance related issue
Milestone

Comments

@Petermarcu
Copy link
Member

@okarlsson commented on Thu Apr 05 2018

Hey Guys!

I'm running a .NET Core application in a docker container that runs in a EC2 instance on AWS.

I have a function for resizing profile images before they get uploaded and I'm using a third party library called ImageSharp for this. The library uses ArrayPools when handling the images and my memory usage shoots up to about 1GB after handling a image.

But after the request has completed the memory usage never goes back, but is allocated to these memory pools.

image

Since I only have 1GB memory in my EC2 instance the entire instance crashes if I try to for example deploy a new version of my app when there is only 70MB memory available.

Is there any way to free up the memory allocated to the ArrayPools after I have finished a request so my containers don't run out of memory?

@RussKeldorph
Copy link
Contributor

@jkotas @Maoni0 Related to #9737, etc.?

@RussKeldorph
Copy link
Contributor

Assuming Future.

@benaadams
Copy link
Member

@okarlsson I mentioned this to @JimBobSquarePants and he mentioned there is a article about memory use for ImageSharp; it also has fine grained control over its pooling with the ArrayPoolMemoryManager; including clearing the pools with ReleaseRetainedResources(), using smaller pools with CreateWithModeratePooling() and CreateWithMinimalPooling() or full control via the ArrayPoolMemoryManager constructor.

HTH

@okarlsson
Copy link

Awesome, thanks for the tip @benaadams

@antonfirsov
Copy link
Member

antonfirsov commented Apr 10, 2018

@okarlsson also make sure to use the latest (beta-3) version of ImageSharp!

Based on your stack trace, you are using an earlier version, where the memory management is immature and sub-optimal!

@okarlsson
Copy link

Will do @antonfirsov , thanks!

@jkotas
Copy link
Member

jkotas commented Aug 8, 2019

Related: https://twitter.com/ladeak87/status/1159092620171337728?s=12

@ghost
Copy link

ghost commented Feb 7, 2024

Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

This process is part of our issue cleanup automation.

@ghost ghost added backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity labels Feb 7, 2024
@ghost
Copy link

ghost commented Feb 21, 2024

This issue will now be closed since it had been marked no-recent-activity but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.

@ghost ghost closed this as completed Feb 21, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 23, 2024
@dotnet-policy-service dotnet-policy-service bot removed no-recent-activity backlog-cleanup-candidate An inactive issue that has been marked for automated closure. labels Mar 23, 2024
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-GC-coreclr tenet-performance Performance related issue
Projects
None yet
Development

No branches or pull requests

7 participants