🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.language.objectpascal
Article #32540

Re: Function that returns a Class

#32540
From: AndyG
Date: Fri, 22 Nov 2002 11:40
14 lines
1487 bytes
"Dana Dill" <dana@danadill.com> wrote in message
news:3ddd61dd$1@newsgroups.borland.com...
?.  "myVar" is a
> local var and when it gets freed it of course frees the assigned object as
> well (Which is really the same. <g>)

seems to me you apply your C++ background to Delphi. When local var gets out
of scope, it is not freed, it's just abandoned. A very popular reason for
memory leakage.

So actually if it does not matter whether a var is local or not - it's your
responsibility to destroy (free) it. it's you who has to control the class
lifetime.
Technical Details
Message-ID: <3dde17d3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!news.maxwell.syr.edu!fu-berlin.de!news.uni-x.net!newsgroups.borland.com!not-for-mail
References: <3ddd61dd$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109d30,a90ac751e87011b2
X-Google-Attributes: gid109d30,public
X-Google-ArrivalTime: 2002-11-22 04:15:45 PST
From: "AndyG" <andyg@sunthunder.com>
Newsgroups: borland.public.delphi.language.objectpascal
References: <3ddd61dd$1@newsgroups.borland.com>
Subject: Re: Function that returns a Class
Date: Fri, 22 Nov 2002 21:40:38 +1000
Lines: 16
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
NNTP-Posting-Host: 211.28.145.179
Message-ID: <3dde17d3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1037965267 211.28.145.179 (22 Nov 2002 03:41:07 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!news.maxwell.syr.edu!fu-berlin.de!news.uni-x.net!newsgroups.borland.com!not-for-mail