Home » SQL & PL/SQL » SQL & PL/SQL » URGENT--Memory size of binary Increasing due 2multithreading
URGENT--Memory size of binary Increasing due 2multithreading [message #208328] Sat, 09 December 2006 10:14
nive_priya
Messages: 1
Registered: December 2006
Location: delhi
Junior Member
Got stuck in Multhithreading in PRO*C.
Memory size of my binary keeps on increasing.

Flow is like this.
My main thread spawns multiple threads of two types of threads. Both types of threads connect to different dbs.
In other words, i need to have multiple connections with to different db's i.e. configure multiple threads for same.
For this i take sql context variable in each thread and pass it to connect_to_db func. for connection. Then that thread use corresponding sql context variable for pl/sql function( CHANGE_INPUT) call.

This keeps of memory size of my binary inceasing.

In above code T_ABILLITY_INPUT is of object type whose ott converted header and out type file is already included.

CHANGE_INPUT is pls/sql function

Can any help me out in using multithreading in pro*c.
It's very-very URGENT, This is creating problem in live site.
Thaks in Advance

Code for process and connect_to_db function is same for both types of threads different is in object types to get process

sample code of connect_to_db

int connect_to_db(char *username, char *password, char *dbname,sql_context *ctx,char *ErrorMessage)
{
int ret;
char ConnString[50] = {0,};
sprintf(ConnString, "%s@%s", username, dbname);


EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--", ErrorMessage);

EXEC SQL ENABLE THREADS;

EXEC SQL CONTEXT ALLOCATE :*ctx;

EXEC SQL CONTEXT USE :*ctx;

EXEC SQL CONNECT :ConnString IDENTIFIED BY :password;

if(sqlca.sqlcode < 0)
return -1;

return 0;
}


sample code for pl/sql function call



int process(double num,char *Flag,char *dbName,char *dbExtApp,char *dbExtUname,char *
dbExtRef,sql_context ctx, char *err)
{

T_ABILLITY_INPUT *typAbilityInputObj;
T_ABILLITY_INPUT_ind *typAbilityInputObj_ind;

T_ABILLITY_INPUT *typAbilityInputObj2;
T_ABILLITY_INPUT_ind *typAbilityInputObj2_ind;

//declaration of some host variables

int iretVal=0;
char extUser[255];
char extApp[255];
char extRef[30];

char us[ABREF_LENGTH];
char app[ABREF_LENGTH];
char ref[ABREF_LENGTH];

memset(extUser,'\0',sizeof(extUser));
memset(extApp,'\0',sizeof(extApp));
memset(extRef,'\0',sizeof(extRef));


memset(us,'\0',ABREF_LENGTH);
memset(app,'\0',ABREF_LENGTH);
memset(ref,'\0',ABREF_LENGTH);


EXEC SQL CONTEXT USE :ctx;

EXEC SQL OBJECT CREATE :typAbilityInputObj:typAbilityInputObj_ind;

EXEC SQL OBJECT CREATE :typAbilityInputObj2:typAbilityInputObj2_ind;

EXEC SQL OBJECT SET EXTERNAL_USER,EXTERNAL_APPLICATION,EXTERNAL_REFERENCE OF : typAbili
tyInputObj TO :extUser, :extApp, :extRef;

EXEC SQL CALL CHANGE_INPUT(:typAbilityInputObj,:typAbilityInputObj2) into iretVal;


EXEC SQL OBJECT GET EXTERNAL_USER,EXTERNAL_APPLICATION,EXTERNAL_REFERENCE FROM :typAbil
ityInputObj2 INTO :us, :app, :ref;


EXEC SQL OBJECT UPDATE :typAbilityInputObj;
EXEC SQL OBJECT UPDATE :typAbilityInputObj2;

EXEC SQL OBJECT RELEASE :typAbilityInputObj;
EXEC SQL OBJECT RELEASE :typAbilityInputObj2;

EXEC SQL OBJECT DELETE :typAbilityInputObj;
EXEC SQL OBJECT DELETE :typAbilityInputObj2;


EXEC SQL COMMIT;
EXEC SQL OBJECT CACHE FREE ALL;

}
Previous Topic: Problem in craeting trigger
Next Topic: Object in table
Goto Forum:
  


Current Time: Fri Dec 09 23:16:20 CST 2016

Total time taken to generate the page: 0.09693 seconds