Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TSqlConnection Memory Leak under Windows 7


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Jul 15, 2014 5:43 AM Last Post By: Timo Hein Threads: [ Previous | Next ]
Timo Hein

Posts: 2
Registered: 12/5/07
TSqlConnection Memory Leak under Windows 7  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 14, 2014 4:24 AM
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.


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;

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

Regards Timo

quinn wildman

Posts: 856
Registered: 12/2/99
Re: TSqlConnection Memory Leak under Windows 7  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 14, 2014 8:44 AM   in response to: Timo Hein in response to: Timo Hein
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.
Timo Hein

Posts: 2
Registered: 12/5/07
Re: TSqlConnection Memory Leak under Windows 7  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 15, 2014 5:43 AM   in response to: quinn wildman in response to: quinn wildman
quinn wildman wrote:
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.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02