Free Support Forum -

Does IFieldMergingCallback automatically dispose the image


If I implement IFieldMergingCallback.ImageFieldMerging and assign an image to ImageFieldMergingArgs can you please confirm if Aspose will dispose the image for me?

For example, would the e.image below get cleaned up automatically by Aspose or do I need to dispose it myself? And if so what is the best place to do this?

  void IFieldMergingCallback.ImageFieldMerging(ImageFieldMergingArgs e)
       e.Image = new Bitmap(@"D:\images\test.png");


Thanks for your inquiry. You do not need to dispose any DOM object. When the document is closed, all the DOM data is purged from memory during the next garbage collector cycle. The memory may not be released until you close the application.