Memory lost on query
-
Albert van Pelt
- Posts: 11
- Joined: Wed 06 Jan 2010 16:48
- Location: Eindhoven
Memory lost on query
I loose 1.2 MB on a get query. This is not consistant.
One out of 1000 queries will result in a memory usage increase of 1.2 Mb.
I use the VCL component in my dll.
The functions i use are threaded.
I use a connection manager with 100 connections. = 100 times TMyConnection -- TMyQuery
I only activate a connection when i use it.
The same TMyConnection -- TMyQuery can be used for inserting / updating and to get data. Not at the same time.
pSQLConnection->Query->SQL->Text = QueryToGet;
pSQLConnection->Query->Execute(); Query->Eof)
{
pAccount_StatusEntryAddNew = new(SAccount_StatusEntry);
..
}
pSQLConnection->Query->Close();
pSQLConnection->Query->SQL->Clear();
Is there someone that experienced the same.
Ans is there a solution ?
I probably do something wrong....
Is there a setting at MyQuery i forgot, or at MyConnectoin i forgot ?
One out of 1000 queries will result in a memory usage increase of 1.2 Mb.
I use the VCL component in my dll.
The functions i use are threaded.
I use a connection manager with 100 connections. = 100 times TMyConnection -- TMyQuery
I only activate a connection when i use it.
The same TMyConnection -- TMyQuery can be used for inserting / updating and to get data. Not at the same time.
pSQLConnection->Query->SQL->Text = QueryToGet;
pSQLConnection->Query->Execute(); Query->Eof)
{
pAccount_StatusEntryAddNew = new(SAccount_StatusEntry);
..
}
pSQLConnection->Query->Close();
pSQLConnection->Query->SQL->Clear();
Is there someone that experienced the same.
Ans is there a solution ?
I probably do something wrong....
Is there a setting at MyQuery i forgot, or at MyConnectoin i forgot ?
-
Albert van Pelt
- Posts: 11
- Joined: Wed 06 Jan 2010 16:48
- Location: Eindhoven
Memory lost on query
I can't make a short sample program a the moment.
I tried several programs using the same way, but the meory leak does not appear.
I know when it happens, and also the connection on which it happens.
PRIO : (3) ID : (2) 52844 / 34436 2010-01-08 16:43:29 - Connectionmanager Get Connection 1
PRIO : (3) ID : (2) 52844 / 34436 2010-01-08 16:43:29 - QueryToInsert connection (1) 1 found inactive connection.
PRIO : (2) ID : (2) 52844 / 34436 2010-01-08 16:43:29 - QueryToInsert connection finished (1) - 0:insert into `SCS`.`scs_locking` ( `SCS_Account_Nmbr`, `SCS_Locking_Mode`, `SCS_Locking_Operator`, `SCS_Locking_DateTime` ) values ( "01007037", '1', "FEP1", '20100108164329' )
PRIO : (3) ID : (2) 52844 / 34436 2010-01-08 16:43:29 - QueryToInsert type (1) 1 changed connection state to inactive connection.
PRIO : (3) ID : (2) 52848 / 34452 2010-01-08 16:43:29 - QueryToGet type 1 search for inactive connection...
PRIO : (3) ID : (2) 52848 / 34452 2010-01-08 16:43:29 - Connectionmanager Get Connection 1
PRIO : (3) ID : (2) 52848 / 34452 2010-01-08 16:43:29 - QueryToGet connection (1) 1 found inactive connection.
PRIO : (1) ID : (2) 52900 / 35752 2010-01-08 16:43:29 - QueryToGet Memory Problem 1
PRIO : (2) ID : (2) 52900 / 35752 2010-01-08 16:43:29 - QueryToGet connection finished (1) - 16:SELECT SCS_Account_Nmbr, SCS_Dealer_Nmbr, SCS_Account_Name, SCS_Account_Backup_Nmbr, SCS_Account_Backup_Alt_Nmbr, .... ` WHERE (SCS_Account_Nmbr = "01007037" OR SCS_Account_Backup_Nmbr = "01007037" ) LIMIT 2
PRIO : (3) ID : (2) 52900 / 35752 2010-01-08 16:43:29 - QueryToGet connection (1) 1 changed connection state to inactive connection.
PRIO : (3) ID : (2) 52900 / 35752 2010-01-08 16:43:29 - QueryToGet connection (1) Memory lost correction
PRIO : (3) ID : (2) 52900 / 35752 2010-01-08 16:43:29 - QueryToGet connection (1) Memory lost correction finished
PRIO : (3) ID : (2) 52872 / 35716 2010-01-08 16:43:29 - QueryToGet type 1 search for inactive connection...
I delete the query component and connection and initialize a new one, but without result.
Is there a debug option i can activate on de TMyQuery ?
In this way i perhaps can see what is happening...
I tried several programs using the same way, but the meory leak does not appear.
I know when it happens, and also the connection on which it happens.
PRIO : (3) ID : (2) 52844 / 34436 2010-01-08 16:43:29 - Connectionmanager Get Connection 1
PRIO : (3) ID : (2) 52844 / 34436 2010-01-08 16:43:29 - QueryToInsert connection (1) 1 found inactive connection.
PRIO : (2) ID : (2) 52844 / 34436 2010-01-08 16:43:29 - QueryToInsert connection finished (1) - 0:insert into `SCS`.`scs_locking` ( `SCS_Account_Nmbr`, `SCS_Locking_Mode`, `SCS_Locking_Operator`, `SCS_Locking_DateTime` ) values ( "01007037", '1', "FEP1", '20100108164329' )
PRIO : (3) ID : (2) 52844 / 34436 2010-01-08 16:43:29 - QueryToInsert type (1) 1 changed connection state to inactive connection.
PRIO : (3) ID : (2) 52848 / 34452 2010-01-08 16:43:29 - QueryToGet type 1 search for inactive connection...
PRIO : (3) ID : (2) 52848 / 34452 2010-01-08 16:43:29 - Connectionmanager Get Connection 1
PRIO : (3) ID : (2) 52848 / 34452 2010-01-08 16:43:29 - QueryToGet connection (1) 1 found inactive connection.
PRIO : (1) ID : (2) 52900 / 35752 2010-01-08 16:43:29 - QueryToGet Memory Problem 1
PRIO : (2) ID : (2) 52900 / 35752 2010-01-08 16:43:29 - QueryToGet connection finished (1) - 16:SELECT SCS_Account_Nmbr, SCS_Dealer_Nmbr, SCS_Account_Name, SCS_Account_Backup_Nmbr, SCS_Account_Backup_Alt_Nmbr, .... ` WHERE (SCS_Account_Nmbr = "01007037" OR SCS_Account_Backup_Nmbr = "01007037" ) LIMIT 2
PRIO : (3) ID : (2) 52900 / 35752 2010-01-08 16:43:29 - QueryToGet connection (1) 1 changed connection state to inactive connection.
PRIO : (3) ID : (2) 52900 / 35752 2010-01-08 16:43:29 - QueryToGet connection (1) Memory lost correction
PRIO : (3) ID : (2) 52900 / 35752 2010-01-08 16:43:29 - QueryToGet connection (1) Memory lost correction finished
PRIO : (3) ID : (2) 52872 / 35716 2010-01-08 16:43:29 - QueryToGet type 1 search for inactive connection...
I delete the query component and connection and initialize a new one, but without result.
Is there a debug option i can activate on de TMyQuery ?
In this way i perhaps can see what is happening...
-
Albert van Pelt
- Posts: 11
- Joined: Wed 06 Jan 2010 16:48
- Location: Eindhoven
-
Albert van Pelt
- Posts: 11
- Joined: Wed 06 Jan 2010 16:48
- Location: Eindhoven
I am using :
Codegear2009 C++ Builder with all the service packs loaded.
MySQL Data access components professional edition
Version 5.90.0.54 for RAD Studio 2009
SQL Srver Data access components rofessional edition
version 4.80.0.54 for RAD Studio 2009
I have no problem with any insert, update, delete....
The problem is only for select statements.
I changed the dll, so the functions are allways sequentional, using mutexes, but without result. I added a debug line before the execute and after the execute to determine if it is actualy this line which causes the increase.
DebugManager->InsertDebugMessage(iLocalServerID, 2,"QueryToGet Open " + IntToStr(pSQLConnection->Entry) + " : " + pSQLConnection->Query->SQL->operator [](0));
pSQLConnection->Query->Execute();
DebugManager->InsertDebugMessage(iLocalServerID, 2,"QueryToGet Execute finished");
Codegear2009 C++ Builder with all the service packs loaded.
MySQL Data access components professional edition
Version 5.90.0.54 for RAD Studio 2009
SQL Srver Data access components rofessional edition
version 4.80.0.54 for RAD Studio 2009
I have no problem with any insert, update, delete....
The problem is only for select statements.
I changed the dll, so the functions are allways sequentional, using mutexes, but without result. I added a debug line before the execute and after the execute to determine if it is actualy this line which causes the increase.
DebugManager->InsertDebugMessage(iLocalServerID, 2,"QueryToGet Open " + IntToStr(pSQLConnection->Entry) + " : " + pSQLConnection->Query->SQL->operator [](0));
pSQLConnection->Query->Execute();
DebugManager->InsertDebugMessage(iLocalServerID, 2,"QueryToGet Execute finished");
-
Albert van Pelt
- Posts: 11
- Joined: Wed 06 Jan 2010 16:48
- Location: Eindhoven
-
Albert van Pelt
- Posts: 11
- Joined: Wed 06 Jan 2010 16:48
- Location: Eindhoven
Still looking because it is not persistent...
Dimon,
Sorry i am trying to get a sample program, but can't dupe in a sample program.
Question
I use the TMyquery to get the info :
pSQLConnection->Query->Close();
pSQLConnection->Query->SQL->Text = QueryToGet;
pSQLConnection->Query->Open();
ProcessQuery();
pSQLConnection->Query->SQL->Clear();
pSQLConnection->Query->Close();
At Processquery i retrieve the data from MyQuery:
while (!pSQLConnection->Query->Eof)
{
.. pointer list with the result.
pSQLConnection->Query->Next();
}
The 1.2 Mb increase is at the Open....
Sometimes....
Seems now to be every +/-15 min.
After many queries likewise.
One thing is 100% sure.
If i don't use a get i don't have any memory increase.....
So insert, delete, update is perfect working in my program.
Only when using a get i sometimes get the problem.
I have the program run the same query over and over again.
Once every 15 minutes the same query results in a 1.2 Mb memory increase.
The query is : SHOW STATUS LIKE 'Ndb%'
Sorry i am trying to get a sample program, but can't dupe in a sample program.
Question
I use the TMyquery to get the info :
pSQLConnection->Query->Close();
pSQLConnection->Query->SQL->Text = QueryToGet;
pSQLConnection->Query->Open();
ProcessQuery();
pSQLConnection->Query->SQL->Clear();
pSQLConnection->Query->Close();
At Processquery i retrieve the data from MyQuery:
while (!pSQLConnection->Query->Eof)
{
.. pointer list with the result.
pSQLConnection->Query->Next();
}
The 1.2 Mb increase is at the Open....
Sometimes....
Seems now to be every +/-15 min.
After many queries likewise.
One thing is 100% sure.
If i don't use a get i don't have any memory increase.....
So insert, delete, update is perfect working in my program.
Only when using a get i sometimes get the problem.
I have the program run the same query over and over again.
Once every 15 minutes the same query results in a 1.2 Mb memory increase.
The query is : SHOW STATUS LIKE 'Ndb%'
-
Albert van Pelt
- Posts: 11
- Joined: Wed 06 Jan 2010 16:48
- Location: Eindhoven
Free ?
Dimon,
Do you mean Clear ?
pSQLConnection->Query->SQL->Clear();
Don't think so, because this is only deleting the SQL statements from the list (i suspect).
I think this is the problem indead, but please advise how to free the memory... which command should i use.
Do you mean Clear ?
pSQLConnection->Query->SQL->Clear();
Don't think so, because this is only deleting the SQL statements from the list (i suspect).
I think this is the problem indead, but please advise how to free the memory... which command should i use.
-
Albert van Pelt
- Posts: 11
- Joined: Wed 06 Jan 2010 16:48
- Location: Eindhoven
Garbage collector
Dimon,
Could it be the garbage collector ?
I am still trying to make a sample, but it's complicated, and can't reproduce it in parts.
When i minimize the program it will free the memory, except used at the dll. So could this be likely....
I am using windows 7 with codegear 2009 to develop..
Albert
Could it be the garbage collector ?
I am still trying to make a sample, but it's complicated, and can't reproduce it in parts.
When i minimize the program it will free the memory, except used at the dll. So could this be likely....
I am using windows 7 with codegear 2009 to develop..
Albert
-
Albert van Pelt
- Posts: 11
- Joined: Wed 06 Jan 2010 16:48
- Location: Eindhoven
Using C++ Builder
Sory but am using C++Builder 2009 from codegear