> I am using a variant of bitmap which does not have the .empty property.
> On formclose I want to free this item, but there is no valid way to check
> its empty property eg
> TFastBMP.size/  tbmp.bmHeader.biSize and so on. So Freeing can be an
invalid
> operation.

When you say:

    Handle.Free

What is actually happening is

    if Handle<>nil then Handle.Destroy;

this calls the 'Destructor' of the type of the object (in your case TBitmap
or similar)

The Destructor should be handling release of resources held within the
object so:

    tbmp.free

would be correct since the contents you are referring to are 'owned' by the
object
whose Destructor will be called.

> So is this valid, or is it leaving an area of memory still being utilised?
>   tbmp:=nil; tbmp.Free;

This is definitely not correct once you know that this is actually doing

    tbmp := nil;
    if tbmp<>nil then tbmp.Destroy;

Hence the Destructor never gets called. This should be all that's necessary

    tbmp.Free;

--
Aaron@home


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to