Page 1 of 1
					
				Memory problem
				Posted: Tue  20 Jun 2006 08:46
				by Hanne Berthelsen
				I am using MySQL Data Access Component (MyDAC) v. 4.00.1.6 / Borland C++ Builder 5
My application slowly "eats up memory" if regularly accessing a field that does not exist even though there is a try ... catch around accessing the nonexisting field. 
    try
    {
      GroupID = MyTable->FieldByName("GroupID")->AsInteger;
    }
    catch (...)
    {
      GroupID = 0;
    }
Would it help to upgrade to latest version of MyDAC ?
			 
			
					
				
				Posted: Tue  20 Jun 2006 09:50
				by Antaeus
				We couldn't reproduce described problem using the current MyDAC build. Try downloading current version of MyDAC (4.30.1.15) and test the problem once more. If it persists then send us (evgeniyD*crlab*com) please a complete small sample to demonstrate it, including script to create and fill table.
			 
			
					
				
				Posted: Wed  21 Jun 2006 08:30
				by Hanne Berthelsen
				I have tried MyDAC v. 4.30.1.15 - problem still exists.
I have sent an example to 'evgeniyD*crlab*com'
Regards Hanne
			 
			
					
				
				Posted: Wed  21 Jun 2006 12:59
				by Antaeus
				We have thoroughly tested this problem. This is memory leak of C++Builder error handling system. It appears when handling exceptions that are raised from functions in dcu made by Delphi. It can be easily reproduced using ADO components instead of MyDAC or by calling 
   
 instead of 
    
Code: Select all
GroupID = MyTable->FieldByName("GroupID")->AsInteger;
 
			 
			
					
				
				Posted: Wed  21 Jun 2006 13:15
				by Hanne Berthelsen
				Does anybody know :
Would it also happen for if upgrading to C++ Builder 6 or Borland Developer Studio 2006?
			 
			
					
				
				Posted: Wed  21 Jun 2006 14:49
				by Antaeus
				We can reproduce this problem in C++Builder 6 but not in Borland Developer Studio 2006. We have tested the solution you have sent us by e-mail. Changing 
to
really helps to avoid the memory leak.
 
			 
			
					
				
				Posted: Thu  22 Jun 2006 07:00
				by Hanne Berthelsen
				I have tested during the last 15 hours. No memory has been lost at all.
Exception has been raised more than 125,000,000 times.
So it is the catch (...) for Borland C++ Builder 5/6 that is the problem and should be substituted by catch (Exception &E).