Our applications is constantly growing in memory. It is a .NET 4.5 application, but our tools shown that the growing memory is unmanaged memory.
We reproduced the same problem with the following example :
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagickLeak
{
class Program
{
static byte[] getPicture(int _iWidth, int _iHeight)
{
byte[] l_arResult = new byte[_iWidth * _iHeight * 4];
Random randNum = new Random();
randNum.NextBytes(l_arResult);
return l_arResult;
}
static void Main(string[] args) {
int l_iOldWidth = 1900;
int l_iOldHeight = 1080;
ImageMagick.MagickImage l_Image = new ImageMagick.MagickImage();
ImageMagick.MagickReadSettings l_ReadSettings = new ImageMagick.MagickReadSettings();
l_ReadSettings.Width = l_iOldWidth;
l_ReadSettings.Height = l_iOldHeight;
l_ReadSettings.Format = ImageMagick.MagickFormat.Bgra;
byte[] l_arData = getPicture(l_iOldWidth, l_iOldHeight);
while (true)
{
try
{
l_Image.Read(l_arData, l_ReadSettings);
}
catch (System.Exception e)
{
Console.WriteLine(e);
}
System.Threading.Thread.Sleep(50);
}
}
}
}
```
This program slowly grows in memory.
We use the last version of Magick .NET ( Magick.NET-6.8.9.101-Q8-x86-net40-client).
I attached a picture showing the growing memory with basic windows tools. I also have ANTS profiling results if needed.
Comments: Fixed in ImageMagick
We reproduced the same problem with the following example :
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagickLeak
{
class Program
{
static byte[] getPicture(int _iWidth, int _iHeight)
{
byte[] l_arResult = new byte[_iWidth * _iHeight * 4];
Random randNum = new Random();
randNum.NextBytes(l_arResult);
return l_arResult;
}
static void Main(string[] args) {
int l_iOldWidth = 1900;
int l_iOldHeight = 1080;
ImageMagick.MagickImage l_Image = new ImageMagick.MagickImage();
ImageMagick.MagickReadSettings l_ReadSettings = new ImageMagick.MagickReadSettings();
l_ReadSettings.Width = l_iOldWidth;
l_ReadSettings.Height = l_iOldHeight;
l_ReadSettings.Format = ImageMagick.MagickFormat.Bgra;
byte[] l_arData = getPicture(l_iOldWidth, l_iOldHeight);
while (true)
{
try
{
l_Image.Read(l_arData, l_ReadSettings);
}
catch (System.Exception e)
{
Console.WriteLine(e);
}
System.Threading.Thread.Sleep(50);
}
}
}
}
```
This program slowly grows in memory.
We use the last version of Magick .NET ( Magick.NET-6.8.9.101-Q8-x86-net40-client).
I attached a picture showing the growing memory with basic windows tools. I also have ANTS profiling results if needed.
Comments: Fixed in ImageMagick