On Mon, 5 Jul 2010 17:46:39 -0300
Marcos Douglas <m...@delfire.net> wrote:

> On Mon, Jul 5, 2010 at 5:30 PM, Mattias Gaertner
> <nc-gaert...@netcologne.de> wrote:
> >
> > No. This will create a mem leak.
> 
> Thanks Mattias, I expect that...
> 
> 
> On Mon, Jul 5, 2010 at 5:39 PM, Martin <f...@mfriebe.de> wrote:
> >
> > that is the same as if you wrote
> >
> >  TsomeObject.create;
> >
> > without assigning the created object to a variable. Both cause a memory
> > leek.
> >
> > Mind you just because "Create" is a constructor does not protect it from
> > being called without using the result.
> 
> Yes, as Mattias said too.
> 
> This type of construction should be banned, no?

No.

TForm1.Create(Application);

Application will free the TForm1.


> Different this, some times I use OUT parameters to force the caller to
> receive the result.


Mattias
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to