Zach Saw
2005-09-08 09:18:37 UTC
Folks,
This is a show stopper!!!
Create an empty project, and throw a button on the form.
And copy and paste this code to the cpp file:
class LeakMe
{
char leaked[10240000];
public:
__fastcall LeakMe(const AnsiString &str)
{
throw Exception("LEAKED!");
}
};
and in your buttonclick handler:
for (int i=0; i<1000000; i++)
{
try
{
new LeakMe("test");
}
catch (const Exception &e)
{
}
}
Compile and run this without the IDE (i.e. run the exe file).
You'll have Windows complaining low virtual memory in seconds (open task
manager and watch out for the virtual memory used column).
However, if we do it this way:
for (int i=0; i<1000000; i++)
{
try
{
AnsiString test = "test";
new LeakMe(test);
}
catch (const Exception &e)
{
}
}
Then there won't be any leaks!
*** PUZZLED *** !!!!!
What is going on inside AnsiString? Who is the culprit?
Please help.
By the way, I want my money back for all the copies of the BCB6 we've bought
if this is not solved ASAP!
This is a show stopper!!!
Create an empty project, and throw a button on the form.
And copy and paste this code to the cpp file:
class LeakMe
{
char leaked[10240000];
public:
__fastcall LeakMe(const AnsiString &str)
{
throw Exception("LEAKED!");
}
};
and in your buttonclick handler:
for (int i=0; i<1000000; i++)
{
try
{
new LeakMe("test");
}
catch (const Exception &e)
{
}
}
Compile and run this without the IDE (i.e. run the exe file).
You'll have Windows complaining low virtual memory in seconds (open task
manager and watch out for the virtual memory used column).
However, if we do it this way:
for (int i=0; i<1000000; i++)
{
try
{
AnsiString test = "test";
new LeakMe(test);
}
catch (const Exception &e)
{
}
}
Then there won't be any leaks!
*** PUZZLED *** !!!!!
What is going on inside AnsiString? Who is the culprit?
Please help.
By the way, I want my money back for all the copies of the BCB6 we've bought
if this is not solved ASAP!