Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Memory leak then load bitmap

Memory leak then load bitmap

3d-Kstudio
Contributor Contributor
387 Views
0 Replies
Message 1 of 1

Memory leak then load bitmap

3d-Kstudio
Contributor
Contributor

I try to open the some HDR image files using NET.
And it looks like memory is leaking.

Next methods doesn't works properly and objects still keep in memory.

 

How to clear the memory?

Thanks in advance.

PS. I use the 3Ds Max 2014.

 

iBitmap.Close(bitmapInfo, BMM_CLOSE_COMPLETE);
global.TheManager.DelBitmap(iBitmap); 

 

public static void OpenBitmaps(string[] imageFiles)
{
	IGlobal global = GlobalInterface.Instance;
	int index = 0;
	foreach (var imageFile in imageFiles)
	{
		IBitmapInfo bitmapInfo;
		IBitmap iBitmap;

		using (bitmapInfo = global.BitmapInfo.Create(imageFile))
		{
			using (iBitmap = global.TheManager.Load(bitmapInfo, (IntPtr.Zero)))
			{

				// Do something
				//SaveBitmap(iBitmap, Path.GetTempPath() + @"\" + index + ".jpg");

				iBitmap.Close(bitmapInfo, BMM_CLOSE_COMPLETE);
				iBitmap.CloseAll(BMM_CLOSE_COMPLETE);

				bitmapInfo.ResetPiData();
				bitmapInfo.ResetProxySubject();

				global.TheManager.DelStorage(iBitmap.Storage);
				global.TheManager.DelBitmap(iBitmap);
			}
		}

		GC.Collect();

		index++;
	}
}
0 Likes
388 Views
0 Replies
Replies (0)