[yunqa.de] TDisqlite3Statement.free - test if "freed"

  • From: "Clyde England" <clyde@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Sat, 18 Jul 2009 17:56:59 +0800

Hi,

After I have finished with a  TDisqlite3Statement I use the free
method to release the corresponding memory. This works fine.

However, I have a need later on in the code to see if this object has
actually been freed or not. I can't test for = "nil" because my
understanding is that the free method just leaves a "dangling
pointer".

My solution is to now always use FreeandNil() for clean up so I can
then test for "nil". So instead of something like:

stmt.free;

I now use:

Freeandnil(stmt);

My questions:

1. Is there a better way to test if TDisqlite3Statement has been freed.?
2. Are there any hidden problems (or performance issues) with using
Freeandnil to free a TDisqlite3Statement
3. Should I just be using the following code instead:

stmt.free;
stmt := nil;

Thanks
Clyde

_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: