Subject Re: [firebird-support] fbserver.exe memory consumption increases by inserting records
Author Ghazanfar Ali
Hello Dimitry,
I am attatching the code that i have written to insert record in the table Employee:

strQuery = "INSERT INTO EMPLOYEE (ID, NAME, ADDRESS, PHONENUMBER, CITY, ADDRESS, COUNTRY) VALUES (1, 'Ghazanfar', 'My Home Address', 03214587126, 'City', 'Country')";
char cpErrorMsg[512];
isc_tr_handle hTransaction = NULL;
//isc_stmt_handle hStatement = NULL;
//Starting the transaction
isc_start_transaction(m_sStatus, &hTransaction, 1, &m_hDatabase, 0, NULL);
//If some error occurs aStatus[0] will be 1 and aStatus will be set to true
if(m_sStatus[0]==1 && m_sStatus[1])
{
long * pStatusVector = m_sStatus;
//Getting the error message from the status array
isc_interprete(cpErrorMsg,&pStatusVector);
strErrorString = cpErrorMsg;
return Error_StartTransaction;
}
////Allocating the statement.
//isc_dsql_allocate_statement(m_sStatus, &m_hDatabase, &hStatement);
////If some error occurs aStatus[0] will be 1 and aStatus will be set to true
//if(m_sStatus[0]==1 && m_sStatus[1])
//{
// long * pStatusVector = m_sStatus;
// isc_rollback_transaction(m_sStatus, &hTransaction);
// //Getting the error message from the status array
// isc_interprete(cpErrorMsg,&pStatusVector);
// strErrorString = cpErrorMsg;
// return Error_DSQLAllocateStatement;
//}
////Preparing the statement
//isc_dsql_prepare(m_sStatus, &hTransaction, &hStatement, (unsigned short )strQuery.length(), (char *)strQuery.c_str(), m_iDialect, NULL);
////If some error occurs aStatus[0] will be 1 and aStatus will be set to true
//if(m_sStatus[0]==1 && m_sStatus[1])
//{
// long * pStatusVector = m_sStatus;
// isc_rollback_transaction(m_sStatus, &hTransaction);
// //Getting the error message from the status array
// isc_interprete(cpErrorMsg,&pStatusVector);
// strErrorString = cpErrorMsg;
// return Error_DSQLPrepare;
//}
short s = (short)strQuery.size();
isc_dsql_execute_immediate(m_sStatus, &m_hDatabase, &hTransaction, s, (char *)strQuery.c_str(), m_iDialect, NULL);
//isc_dsql_execute(m_sStatus, &hTransaction, &hStatement, m_iDialect, NULL);
//If some error occurs aStatus[0] will be 1 and aStatus will be set to true
if(m_sStatus[0]==1 && m_sStatus[1])
{
long * pStatusVector = m_sStatus;
isc_rollback_transaction(m_sStatus, &hTransaction);
//Getting the error message from the status array
isc_interprete(cpErrorMsg,&pStatusVector);
strErrorString = cpErrorMsg;
return Error_DSQLExecute;
}
//isc_dsql_free_statement(m_sStatus, &hStatement, DSQL_close);
////If some error occurs aStatus[0] will be 1 and aStatus will be set to true
//if(m_sStatus[0]==1 && m_sStatus[1])
//{
// long * pStatusVector = m_sStatus;
// //Getting the error message from the status array
// isc_interprete(cpErrorMsg,&pStatusVector);
// strErrorString = cpErrorMsg;
// //We are not going to return because execute procedure is not a SQL Statement
// //return Error_FreeStatement;
//}
isc_commit_transaction(m_sStatus, &hTransaction);
//If some error occurs aStatus[0] will be 1 and aStatus will be set to true
if(m_sStatus[0]==1 && m_sStatus[1])
{
long * pStatusVector = m_sStatus;
isc_rollback_transaction(m_sStatus, &hTransaction);
//Getting the error message from the status array
isc_interprete(cpErrorMsg,&pStatusVector);
strErrorString = cpErrorMsg;
return Error_CommitTransaction;
}


Dimitry Sibiryakov <SD@...> wrote:
On 30 Jan 2006 at 5:42, Ghazanfar Ali wrote:

> But still i am having that 10 MB
> leak, one thing i want to tell is that when i detach from the
> database all that extra memory has been properly released, but i
> want to keep the connection active as normally done in servers that
> maintaining a single connection untill someone stops the server or
> shuts downs the database server. please give me some solution
> regarding this issue,

So, you want me to debug your application without even seeing the
code? You must be joking!

--
SY, Dimitry Sibiryakov.




++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Yahoo! Groups Links










---------------------------------
Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.

[Non-text portions of this message have been removed]