Page 1 of 1

Control (limit) resource usage in Magick.NET using C#

Posted: 2018-07-01T14:02:04-07:00
by Ljurka
I am looking for the write to way setup limit memory from backend C# code.
I see that it possible via command line -limit memory 32MiB
but could I set up it via backend C#? The rest of settings I would like to leave as is by default.

Also I see that ImageMagick.Configuration.ConfigurationFiles but do not know is it what I need or not and how it could be used if yes.

Any help would be much appreciated.

Re: Control (limit) resource usage in Magick.NET using C#

Posted: 2018-07-01T22:39:39-07:00
by dlemstra
You are looking for the ResourceLimits class.

Re: Control (limit) resource usage in Magick.NET using C#

Posted: 2018-07-02T02:01:27-07:00
by Ljurka
Thank you!
Is it enough just to set ResourceLimits.Memory=32...
or is it require more sophisticated initizlization?

Re: Control (limit) resource usage in Magick.NET using C#

Posted: 2018-07-03T11:22:56-07:00
by dlemstra
The value is in bytes so you should set it to `33554432` if you want to limit it to 32MiB