Open GoogleCodeExporter opened 9 years ago
I changed the BitmapRenderer.cs Dispose method to this:
protected virtual void Dispose(bool disposing)
{
Kernel32Native.GlobalUnlock(_dibHandle);
Kernel32Native.GlobalFree(_dibHandle);
}
This freed the memory allocated for the image. I write the image to disk
rather than
placing the image in a list. this solved my problem.
Original comment by david.h...@medianotion.com
on 20 Feb 2010 at 6:53
Original comment by luke.qui...@gmail.com
on 21 Feb 2010 at 11:04
Hi David,
Could you please share your implementation?
Thanks
Original comment by baburaj....@gmail.com
on 11 Mar 2010 at 12:26
Honestly, I am no longer using TwainDotNet. I needed some functionality it
could not
provide at this time. Anyway, here is what I had before I stopped using it.
See in
DataSourceManager.FilterMessage where I write the image to file. See in
BitmapRenderer.Dispose where I free the memory after writing the file. HTH
Original comment by david.h...@medianotion.com
on 11 Mar 2010 at 3:02
Attachments:
Thanks David. That helped me.
Original comment by baburaj....@gmail.com
on 15 Mar 2010 at 2:45
I've an update. Seems like we need to reopen this defect. Though David's sample
helped me to get this working for around 6 scans (Duplex, 600dpi, B&W) without
any
issue TwainDotNet crashes with OutOfMemoryException as I try with more pages.
Memory
usage by the application as I could notice from Task manager is around 900MB. Is
there any better way to manage Memory?
Original comment by peri...@gmail.com
on 17 Mar 2010 at 1:21
Sorry I didn't realise that this issue didn't reopen. I think perhaps
DataSourceManager
would need to be changed to fire an event as each image came in instead of
queuing them
all up into a list.
Original comment by luke.qui...@gmail.com
on 1 Apr 2010 at 12:19
If anybody is still looking for a solution, Instead of collecting the
pointer "picturePointers.Add(hbitmap)" in DataSourceManager.TransferPictures, I
invoked a thread that saves the image. Without the thread, the scanner will be
forced to wait while the image is being saved. To keep track of the images, I
created a List<filenames>.
Original comment by jeff.he...@gmail.com
on 11 May 2010 at 11:48
Hi Jeff,
I am interested in the solution that you have proposed as I am facing a similar
issue. When I am using the app to scan more than 50-60 images using ADF the app
crashes with OutOfMemoryException.
If you have tested your code and it works for such a scenario, Can you please
share your updated code file(s) here?
If you have not tested your code for such a scenario, I will test it for even
larger scans and post my findings here.
Original comment by tejesh.p...@gmail.com
on 9 Sep 2010 at 6:53
Hi Tejesh,
Unfortunately I am unable to share my code with you. I did test it with a high speed scanner (90DPI-180PPI) with over 250 sheets in duplex mode. It worked as expected.
The fix was simple; pass the image pointer and the new file name into a thread
that saves the image. After the scanning was complete, I waited for all the
threads to complete.
I wish I could be more specific but I have not seen that block of code since I
wrote it.
-Jeff
Original comment by jeff.he...@gmail.com
on 10 Sep 2010 at 1:33
Hi all!
I recently except same problem, and i notice that memory used by Bitmap
objects.
Then i manually call Dispose on Bitmap in TransferImageEventArgs after save
image to temp file.
It solve the problem, and program can scan any huge ammount of pages.
Good luck ;)
Original comment by zgg...@gmail.com
on 17 Feb 2012 at 9:36
Hello zgg,
Can you please tell me where you put that Dispose(). I've been having the same
issue. Or can you please send me the file to my email?
Thanks,
-Hameed
Original comment by faif...@gmail.com
on 24 Apr 2012 at 4:05
Original issue reported on code.google.com by
david.h...@medianotion.com
on 19 Feb 2010 at 9:26