-
-
Notifications
You must be signed in to change notification settings - Fork 887
Description
Prerequisites
- I have written a descriptive issue title
- I have verified that I am running the latest version of ImageSharp
- I have verified if the problem exist in both
DEBUGandRELEASEmode - I have searched open and closed issues to ensure it has not already been reported
Description
Running image sharp on multiple images causes memory to increase up to 1.5 GB
Steps to Reproduce
I have the following code that is hosted in an AWS lambda.
// This is a member function of my PictureProvider class
public void Resize(Stream sourceStream, string target, int newWidth, int newHeight)
{
using (var image = Image.Load(sourceStream))
using (var outputFile = File.OpenWrite(target))
{
image.Mutate(ctx => ctx.Resize(newWidth, newHeight));
image.SaveAsJpeg(outputFile);
}
}This code has been used since this morning in production by our web site where our users upload their own image that can range from 1500x1500 to 6000x6000 in JPEG and PNG format.
When I look at the AWS lambda execution logs, I see the following:
As you can see the memory consumed by the lambda only keeps on increasing... until it reaches the 1500 MB that I allocated to the lambda. At this point the lambda dies and AWS instantiates a new fresh container for the lambda.
Here's what I intent to do: I will try to replace the default memory manager by the SimpleGcMemoryManager which is not supposed to pool memory as indicated here. Let me know if you have any other suggestion.
System Configuration
- ImageSharp version:1.0.0-beta0003
- Environment (Operating system, version and so on): AWS lambda running on dotnet core 2.0 on linux
- .NET Framework version: netcoreapp2.0
