VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 123[4]5678910 ]


[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 19:15:32 11/05/02 Tue
Author: David Bracken
Subject: memory not being freed

Michel,
Hello again!

I am at my wits end. I have tried everything i can think of to free up the memory being allocated after each image is saved out. I have run my scanning program through MemProof, and it says there are no memory leaks detected. But using windows task manager to view the mem usage and vm size while scanning, it shows the memory being written to, but never being freed. I am going to show you the current incarnation of my code, so you can tell me what you think i may be doing wrong.

procedure TfrmMainScan.Scan1AfterScan(Sender: TObject; PageNumber: Integer);
{var hDIB: longint;}{Graphic : TTiffGraphic; }
begin
try
{Graphic := TTiffGraphic.Create; }
{ImageScrollBox.Clear;}
try
if nnameset <> true then begin
if conbatch = true then begin
flename := origname;
end;
ccounter := ccounter + 1;
if ccounter < 10 then begin
ppagecount := '_000' + inttostr(ccounter);
end;
if (ccounter >= 10) and (ccounter < 100) then begin
ppagecount := '_00' + inttostr(ccounter);
end;
if (ccounter >= 100) and (ccounter < 1000) then begin
ppagecount := '_0' + inttostr(ccounter);
end;
if ccounter >= 1000 then begin
ppagecount := '_' + inttostr(ccounter);
end;
end;
try


imagescrollbox.Graphic.AssignFromDIBHandle(Scan1.hDib);
ImageScrollBox.Redraw(true);
{Graphic.AssignFromDIBHandle(scan1.hdib); }
{ImageScrollBox.Graphic := Graphic;}
if replacepage = true then begin
ImageScrollBox.SaveToFile(flename);
Caption := 'PowerScan - ' + FleName;
replacepage := false;
p1.Position := 0;
FileListBox1.Update;
exit;
end;
if insertpage = true then begin
ImageScrollBox.SaveToFile(flename);
Caption := 'PowerScan - ' + FleName;
insertpage := false;
p1.Position := 0;
{frmMainScan.Update;}
FileListBox1.Update;
exit;
end;
SingleProcess;
p1.Position := 0;
{frmMainScan.Update; }

except
On E:Exception do begin
if Scan1.ScanErrorString = 'Paper jammed in scanner; clear paper and continue.' then begin
messagedlg(Scan1.ScanErrorString, mtError, [mbok],0);
end else begin
messagedlg('After Scan Error:' +e.Message, mterror,[mbok],0);
end;
end;
end;
except
on e:Exception do begin
messagedlg('Scan1AfterScan: ' + e.Message, mtError, [mbok],0);
end;
end;
finally

frmMainScan.Update;

end;
end;

Scan1 is the name of the pegasus isis scanning control i am using to pull the images in. The event you see above is the Afterscan event, which fires after every image is scanned in.

I would appreciate any help you can give.
P.S. I can send you more code examples if you wish.

Thanks,
Dave

[ Next Thread | Previous Thread | Next Message | Previous Message ]


Replies:


[ Contact Forum Admin ]


Forum timezone: GMT-5
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.