Mega Search
23.2 Million


Sign Up

Make a donation  
TSqlConnection Memory Leak under Windows 7  
News Group: embarcadero.public.delphi.database.dbexpress

Hello,

I am using Delphi 2010 to access a Sybase database via dbexpress.
Under Windows XP the program works fine but under Windows 7 its memory consumption grows infinitely.

I identified the place in the code where in my opinion the problem comes from.

The program connects to multiple servers and the problem (memory growth) occurs when a connection is closed and then reopened.



{code}
function ChangeLineStatusServer(currentLine : TLine) : String;
var
LastServerName : String;
msg : String;
begin
  LastServerName := '';

  //THN20091109 - DBExpress

  if DMHMacs.dbHMacs_LineStatus.Params.IndexOfName('HOSTNAME') <> -1 then LastServerName := DMHMacs.dbHMacs_LineStatus.Params[DMHMacs.dbHMacs_LineStatus.Params.IndexOfName('HOSTNAME')];
  if LastServerName <> 'HOSTNAME =' + currentLine.ServerName then
  begin
    DMHMacs.dbHMacs_LineStatus.Close;
    DMHMacs.dbHMacs_LineStatus.Params.Clear;
    DMHMacs.dbHMacs_LineStatus.Params.Add('DRIVERNAME=ASE');
    DMHMacs.dbHMacs_LineStatus.Params.Add('DATABASE NAME='+DataBase);
    DMHMacs.dbHMacs_LineStatus.Params.Add('HOSTNAME='+currentLine.ServerName);
    DMHMacs.dbHMacs_LineStatus.Params.Add('USER_NAME='+LogID);
    DMHMacs.dbHMacs_LineStatus.Params.Add('PASSWORD='+LogPass);
    DMHMacs.dbHMacs_LineStatus.Params.Add('IsolationLevel=DirtyRead');

    try
      DMHMacs.dbHMacs_LineStatus.Open;
      result := '';
      if not DMHMacs.dbHMacs_LineStatus.Connected then
      begin
        Result := 'Verbindungsfehler';
      end
      else Result := '';
    except
       on E: exception do
       begin
          SybaseException(E,Msg);

          if CurrentLine.verbindungErrorCount < 5 then
          begin
            inc(CurrentLine.verbindungErrorCount);
            sleep(500);
            ChangeLineStatusServer(currentLine);
          end
          else if CurrentLine.verbindungErrorCount >= 5 then
          begin
            ShowMessage( CurrentLine.Description + ' DatenBank Verbindung nicht OK ! Server ' + currentLine.ServerName + ' ! ' + msg);
            CurrentLine.verbindungErrorCount := 0;
          end;

         Result := msg;
       end;
    end;
    end
  else Result := '';
end;
{code}
 

Is there perhaps another possibility to change the server on the connection or perhaps a patch for dbexpress?


Regards Timo

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 14-Jul-2014, at 4:24 AM EST
From: Timo Hein
 
Re: TSqlConnection Memory Leak under Windows 7  
News Group: embarcadero.public.delphi.database.dbexpress
> {quote:title=quinn wildman wrote:}{quote}
> Timo Hein wrote:
> > Is there perhaps another possibility to change the server on the connection or perhaps a patch for dbexpress?
> 
> All downloads available to you are available from our registered users 
> download area. Here is how:
> 
> 1. http://members.embarcadero.com
> 2. Login using the same credentials you have used in the past to 
> register your product
> 3. Agree to export terms if prompted to do so.
> 4. Click Mt registered user downloads.
> 
> This all being said, I did brief search in our defect tracking system 
> and find no defects in this regard. I am skeptical there is any update 
> for this issue. However, what I suggest is you download the XE6 trial. 
> If the problem occurs there as well, you will know that no update is 
> available to resolve your issue.

I downloaded XE6 trial. But the problem stays the same.

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 15-Jul-2014, at 5:43 AM EST
From: Timo Hein
 
Re: TSqlConnection Memory Leak under Windows 7  
News Group: embarcadero.public.delphi.database.dbexpress
Timo Hein wrote:
> Is there perhaps another possibility to change the server on the connection or perhaps a patch for dbexpress?

All downloads available to you are available from our registered users 
download area. Here is how:

1. http://members.embarcadero.com
2. Login using the same credentials you have used in the past to 
register your product
3. Agree to export terms if prompted to do so.
4. Click Mt registered user downloads.

This all being said, I did brief search in our defect tracking system 
and find no defects in this regard. I am skeptical there is any update 
for this issue. However, what I suggest is you download the XE6 trial. 
If the problem occurs there as well, you will know that no update is 
available to resolve your issue.

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 14-Jul-2014, at 8:44 AM EST
From: quinn wildman