[fpc-pascal] Basic question about TStringList

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Mar 27 13:36:26 CET 2008


On 27 Mar 2008, at 13:27, g.marcou at chimie.u-strasbg.fr wrote:

> Let A be a TStringList, I have two ways to catch the result of my  
> function:
>
> A:=Myfunction();
>
> or
>
> A.Assign(Myfunction());
>
> In the first case, if do A.Free, I release the memory allocated by  
> the function. What's arriving in the second case? I can do A.Free,  
> but does that action will also release the memory allocated by the  
> function?

No.

> By the way, do you have some tricks to detect this kind of error?

Compile with -ghl


Jonas



More information about the fpc-pascal mailing list