TWAIN ActiveX Control, Plug-in, Scanner SDK, Component, HTTP Control/SDK

Dynamsoft TWAIN Products

Support Community for TWAIN Control/Component/SDK for Scanning Solutions
* Login   * Register
* FAQ    * Search

It is currently Sun May 20, 2012 3:47 pm




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Memory Leak when using the Picture method in WebTWAIN
PostPosted: Fri Mar 07, 2008 2:37 pm 
Offline

Joined: Fri Mar 07, 2008 2:27 pm
Posts: 7
Hi,

I need to figure out a way to solve this problem and have written a small sample web page that demonstrates the issues. When using javascript in a web page calling the twain.Picture(1) method eventually causes a memory leak. How do you dispose of this object in javascript? The delete method in javascript doesn't work and I believe there should be a method in WebTWAIN to release the reference pointer so COM reference counting allows the release of this object.

Here's more details about my test method:

-put the usual webTwain object elements into html file.
-attach the post transfer and postAllTransfers events.
-open the source, set properties and acquire
-in on post transfer I test for PendingXfers and loop over the HowManyImagesInBuffer and finally set the CurrentImageIndexInBuffer to my loops ctr.
-next I simply call var iPictureDisp = twain.Picture(i).

This works successfully several times in my test harness and eventually gives me out of memory exception which can only be remedied by closing the Internet Explorer process.

Is there a solution to this or do I need to purchase another Twain library to solve my problems? Currently I use this Picture method to obtain an IPictureDisp which is passed into a barcode reader library (ocx) which will find the barcodes on these documents so I can identify them, rotate the document as necessary. Finally I send them to my server for storage.

Just to be completely clear it's not a problem with the barcode library as I've switched that off and simply do var iPictureDisp = twain.Picture(i) as I stated before.

Please help me with this, it's wasting my time.


Dan


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 09, 2008 10:15 pm 
Offline
User avatar

Joined: Mon Mar 07, 2005 11:11 pm
Posts: 866
Please call the CloseSource method before another operation begins.
Also, you can send your simplified code to twainsupport@dynamsoft.com. Our support team will help you with this.

Thanks.

_________________
Robert
TWAIN Support Team
http://www.dynamsoft.com/
TWAIN ActiveX/Plug-in HTTP Control/SDK & TWAIN ActiveX Control, Scanner SDK, Component
Software Configuration Management | SCM Solution


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 10, 2008 1:22 am 
Offline

Joined: Fri Mar 07, 2008 2:27 pm
Posts: 7
Hi Robert,

CloseSource is called in the PostAll event. What else should I be doing? Please note this behaviour only occurs when calling the Picture method in the other post method. I created a simple test harness that tests the entire set of functionality our application uses after stumbling across a memory leak. When I avoid calling Picture this memory error never comes up.

Seeing as we're starting UAT this error has been found usually after scanning 6-10 documents and leaving the scanning page to preview the images. This scanning page is then re-visited after the preview and this process can be done > 50 times. I need this problem to go away so I can deliver my application on time. I'll send in my sample test harness when I arrive at work in the morning. I'm sure you guys have a test harness that works similarly though and imagine that opening the source happens prior to acquiring the image. Once the images are acquired the two post events occur. In the first post event we're simply iterating the number of pages and just assigning the Picture to a var in javascript. Finally we close the source in the other postAll event. If we avoid the Picture assignment all is peachy and no out of memory errors. We use this Picture IPictureDisp to read any barcodes present on each document. I've removed the barcode piece to determine what the problems were.

Thanks,
Dan


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 11, 2008 11:31 pm 
Offline
User avatar

Joined: Mon Mar 07, 2005 11:11 pm
Posts: 866
Our support team has received the file and are looking into this issue.

Thanks.

_________________
Robert
TWAIN Support Team
http://www.dynamsoft.com/
TWAIN ActiveX/Plug-in HTTP Control/SDK & TWAIN ActiveX Control, Scanner SDK, Component
Software Configuration Management | SCM Solution


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

It is currently Sun May 20, 2012 3:47 pm


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Copyright © 2010 Dynamsoft Corporation. All Rights Reserved. | Knowledge Base | Source Control Blog