countrypaul
Technical User
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;
}
}
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;
}
}