Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 10 of 21 total |
Access Violation when freeing table |
Tue, Mar 21 2006 8:18 AM | Permanent Link |
"Bern Rudisill" | |
Tue, Mar 21 2006 11:45 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Bern
As a guess its already been freed. Or at least that's what it usually means for me. I'd suggest an "if assigned(table) then table.free" Roy Lambert |
Tue, Mar 21 2006 11:55 AM | Permanent Link |
"Bern Rudisill" | Roy Lambert wrote:
> Bern > > > As a guess its already been freed. Or at least that's what it usually > means for me. I'd suggest an "if assigned(table) then table.free" > > Roy Lambert I thought about that and I am already doing that. Bern -- |
Tue, Mar 21 2006 1:00 PM | Permanent Link |
Roy, check out the source. It is already checking for nil for you...
procedure TObject.Free; asm TEST EAX,EAX JE @@exit MOV ECX,[EAX] MOV DL,1 CALL dword ptr [ECX].vmtDestroy @@exit: end; --Bill Sparrow-- | |
Tue, Mar 21 2006 2:47 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Bern,
<< For some reason I am randomly getting an AV when I free tables. Here is a snip from the bug report I am getting (I have also attached the bug report in case it helps). Basically at line 8702 in my data module I am doing a .free of the table then I get the AV. >> Is there any chance that the data module's components are being improperly shared between threads ? That's where I would start looking. -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Mar 21 2006 3:30 PM | Permanent Link |
Sean McCall | Roy,
FreeAndNil(Table) would be more like it. AObject.Free won't do anything if AObject = nil, so checking to see if is assigned doesn't get you anything. Using FreeAndNil will set the object reference to nil so you don't have a bad pointer hanging around. Also, Assigned(AObject) returns true whether or not the reference points to a valid object. Try putting a single button on a form: procedure TForm1.Button1Click(Sender: TObject); var AObject: TObject; begin AObject := TObject.Create; AObject.Free; if Assigned(AObject) then begin Button1.Caption := Button1.Caption + ' Assigned'; end; {if assigned} end; Run the application and click the button. It will say "Assigned" because the object reference is not nil even though the object had been freed. Then replace AObject.Free with FreeAndNil(AObject) and try again. Sean Roy Lambert wrote: > Bern > > > As a guess its already been freed. Or at least that's what it usually means for me. I'd suggest an "if assigned(table) then table.free" > > Roy Lambert > |
Tue, Mar 21 2006 7:47 PM | Permanent Link |
"Bern Rudisill" | Tim Young [Elevate Software] wrote:
> Bern, > > << For some reason I am randomly getting an AV when I free tables. > Here is a snip from the bug report I am getting (I have also attached > the bug report in case it helps). Basically at line 8702 in my data > module I am doing a .free of the table then I get the AV. >> > > Is there any chance that the data module's components are being > improperly shared between threads ? That's where I would start > looking. Each component is created dynamically in the data module to be thread safe. But even so the procedure that is having the problem is not used by a thread. Bern -- |
Wed, Mar 22 2006 3:18 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Bill
1. I never got into assembler - tried and failed 2. I that case why do I get AV's when trying to free an object that's already been freed? Roy Lambert |
Wed, Mar 22 2006 11:21 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Bern,
<< Each component is created dynamically in the data module to be thread safe. But even so the procedure that is having the problem is not used by a thread. >> And there's no chance that there's a Free taking place on a previously-freed or uninitialized object reference ? -- Tim Young Elevate Software www.elevatesoft.com |
Wed, Mar 22 2006 12:47 PM | Permanent Link |
"Bern Rudisill" | Tim Young [Elevate Software] wrote:
> Bern, > > << Each component is created dynamically in the data module to be > thread safe. But even so the procedure that is having the problem is > not used by a thread. >> > > And there's no chance that there's a Free taking place on a > previously-freed or uninitialized object reference ? Nope I checked the code and there is only 1 place where the table is freed in the entire project. BTW I see I did not put it in the orginal post, but this is random. Bern -- |
Page 1 of 3 | Next Page » | |
Jump to Page: 1 2 3 |
This web page was last updated on Thursday, May 23, 2024 at 07:54 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |