You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a similar issue. Every time I initiated a scan the memory usage would just continue to grow and no amount of disposes and forced garbage collection would help.
The solution I ended up with was fairly simple. When calling the e.GetNativeImageStream be sure to make sure it is in a using clause like this
if (e.NativeData != IntPtr.Zero)
{
using (Stream stream = e.GetNativeImageStream())
{
if (stream != null)
{
img = Image.FromStream(stream);
}
}
}
It seems when the stream is put into a variable the system will not garbage collect even after flushing, closing, and disposing of the stream.
Hello!
I'm trying to scan using 'Sample.Winform' inside the ntwain program source.
The function is working normally, and I am monitoring this program as a task manager.
However, after proceeding with the scan, I checked that the memory of the application continues to increase.
After scanning a large amount of paper documents, there is a risk of memory leak later.
Is there a way to manage memory properly?
Please give me some advice on this.
Thank you.
The text was updated successfully, but these errors were encountered: