Article View: borland.public.cppbuilder.nativeapi
Article #2635Re: Memory Leak - TForm or TStringGrid or DynamicArray
From: Dan Mayo
Date: Wed, 07 Feb 2007 21:30
Date: Wed, 07 Feb 2007 21:30
55 lines
2468 bytes
2468 bytes
Any ideas why I am still having an exception when I try to create a
TForm would be appreciated!
Dan Mayo wrote:
> Remy Lebeau (TeamB) wrote:
>> That is what CodeGuard is for instead.
Codeguard is now on. The only memory errors it reported were String
constructions such as the following:
const String SettingsFilePath =
ExtractFileDir(Application->ExeName)+"\\Settings.ini";
It reported attempting to index an out of bounds the char*; which to me
seemed odd; but I got rid of that error by using casting to the following:
const String SettingsFilePath =
ExtractFileDir(Application->ExeName)+static_cast<String>("\\Settings.ini");
Now, my code is running. No warnings or errors during compile or
PC-Lint, no errors reported by CodeGuard or EurekaLog during operation;
however, I am still getting an exception occasionally from the simplied
following:
void Bar()
{
TSubForm *Foo;
try
{
try
{
Application->ProcessMessages();
Foo = new TSubForm(this);
try
{
//do some interesting things and update objects on Foo
}
catch (...)
{
ShowMessage("Some other error occurred");
}
}
catch (...)
{
ShowMessage("Unable to create Foo");
}
}
__finally()
{
if (Foo!=NULL)
{
delete Foo;
}
}
}
Technical Details
Message-ID:
<45ca4546$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.cw.net!cw.net!news-FFM2.ecrc.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>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,191a7d21d69bde32 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Wed, 07 Feb 2007 15:30:47 -0600 From: Dan Mayo <do_not_spam_dmayo2@netzero.com> User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Memory Leak - TForm or TStringGrid or DynamicArray References: <45c7810f@newsgroups.borland.com> <45c7dc8d$1@newsgroups.borland.com> <45c89ec6@newsgroups.borland.com> In-Reply-To: <45c89ec6@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 216.174.165.174 Message-ID: <45ca4546$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1170883910 216.174.165.174 (7 Feb 2007 13:31:50 -0800) Lines: 56 Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail