Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pro*c memory leak during connect ?

Status
Not open for further replies.

countrypaul

Technical User
Apr 29, 2004
48
GB
Hi,

I have an application that periodically connects to Oracle executes some SQL then closes the connection. This application is multithreaded and using Oracle 9.2. It appears that when the CONEXT FREE is executed no memory is released - and the next time round more is allocated. It appears that about 64K is lost on each occasion. I have reduced the problem to the code below. Have I missed somthing, am I doing something wrong ?

TIA

Paul

#define ERROR sqlca.sqlcode != 0
#pragma comment(lib, "oraSQL9.lib")
#include <stdio.h>
#include "sqlca.h"
#include <conio.h>
#include <string.h>

void main ()
{

EXEC SQL BEGIN DECLARE SECTION;
sql_context ctx;
char logonstring[128];
EXEC SQL END DECLARE SECTION;
int i = 0;

EXEC SQL ENABLE THREADS;

while (i == 0)
{
EXEC SQL CONTEXT ALLOCATE :ctx;
EXEC SQL CONTEXT USE :ctx;

strcpy(logonstring, "Paul/paul@test");
EXEC SQL CONNECT :logonstring;

if (ERROR)
{
printf("Error from connect/r/n");
}
EXEC SQL COMMIT WORK RELEASE;
EXEC SQL CONTEXT FREE :ctx;

i = getchar();
if (i != 10) break;
i = 0;
}

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top