[fpc-pascal] Newbie problems with memory leak and access violation/AV

Jim hakkie42 at gmail.com
Tue Mar 30 09:38:45 CEST 2010

On 30-3-2010 9:28, Michael Van Canneyt wrote:
> After allocating an object which you will free in the same routine,
> you should ALWAYS put a try..finally statement, and free the object in
> the
> finally clause: 
++ makes sense.
> After that, the error still happens, but at least there is no memory
> leak.
> The error is the following:
>    FreeAndNil(Item); //Don't really now if we should do this but it
> can't hurt. Can it?
> It CAN hurt: TSearchRec is a record, you don't need to free it.
++Ok, clear.
> Michael.


Thanks for the quick & clear explanation! I'll give it a go and get back
to the list if (when ;) I've got more problems...


More information about the fpc-pascal mailing list