Article View: borland.public.cppbuilder.nativeapi
Article #2502Re: Memory Leak - TForm or TStringGrid or DynamicArray
From: Remy Lebeau (TeamB)
Date: Thu, 08 Feb 2007 18:07
Date: Thu, 08 Feb 2007 18:07
19 lines
1727 bytes
1727 bytes
"Dan Mayo" <do_not_spam_dmayo2@netzero.com> wrote in message
news:45cb3451$1@newsgroups.borland.com...
> TForm test;
> delete test; //fails miserably
It is safe to call 'delete' on a NULL pointer. In the code above,
test is *not* NULL. It is not even a pointer, so you can't call
'delete' on it anyway. In case you meant to declare it as a pointer,
it would be an unintialized pointer, so it would have a random value.
Variables are not automatically intialized to zero when declared. You
have to do that explicitally in code, ie:
TForm *test = NULL;
delete test; // works fine
Gambit
Technical Details
Message-ID:
<45cb6703@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<45c7810f@newsgroups.borland.com> <45c7dc8d$1@newsgroups.borland.com> <45c89ec6@newsgroups.borland.com> <45ca4546$1@newsgroups.borland.com> <0sqks2t4c90epuc62bv635h36cqeat0ujd@4ax.com> <45cb3451$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,191a7d21d69bde32 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <45c7810f@newsgroups.borland.com> <45c7dc8d$1@newsgroups.borland.com> <45c89ec6@newsgroups.borland.com> <45ca4546$1@newsgroups.borland.com> <0sqks2t4c90epuc62bv635h36cqeat0ujd@4ax.com> <45cb3451$1@newsgroups.borland.com> Subject: Re: Memory Leak - TForm or TStringGrid or DynamicArray Date: Thu, 8 Feb 2007 10:07:20 -0800 Lines: 21 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 75.83.34.171 Message-ID: <45cb6703@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1170958083 75.83.34.171 (8 Feb 2007 10:08:03 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail