I'm writing a program that loads Dicomfile and makes adjustments.
dll is using clear canvas. However, loading that object into clear canvas seems to cause a strangely significant memory leak. ex) A resource of about 350mb of memory was loaded, but it actually occupies about 1.7G of memory.
This is where the problem arises. clearcanvas was built as a 32-bit program, so I was using 32-bit. That's why GC() is being called. every time because of the 2gb memory limit. OOM problems occur.
RedTriangle is GC
371.231782MB
This is a list stored in my memory. How can I solve this problem?
this is LoadDIcomFile()
public Bitmap Bitmap;
public string FilePath;
public ImageSop ImageSop;
public DicomFile DicomFile;
public IPresentationImage PresentationImage;
public int InstanceNumber = 0;
public DicomElement(string filePath)
{
this.FilePath = filePath;
DicomFile = new DicomFile(filePath);
DicomFile.Load();
ImageSop = new ClearCanvas.ImageViewer.StudyManagement.ImageSop(filePath);
PresentationImage =
PresentationImageFactory.Create(ImageSop.Frames[1]);
int width = ImageSop.Frames[1].Columns;
int height = ImageSop.Frames[1].Rows;
this.Bitmap = PresentationImage.DrawToBitmap(width, height);
if (DicomFile.DataSet[DicomTags.InstanceNumber] == null)
{
throw new Exception("Tag 'Instance Number' not found!");
}
this.InstanceNumber = DicomFile.DataSet[DicomTags.InstanceNumber].GetInt32(0, 1);
}
this is DicomFile.Load(); https://github.com/ClearCanvas/ClearCanvas/blob/master/Dicom/DicomFile.cs
I've been looking for a solution for 5 days, but I can't seem to find it, so I'm asking the question after much deliberation.