Subject | Re: runaway process |
---|---|
Author | Torsten Welches |
Post date | 2000-09-22T06:42:54Z |
Ken,
let me start by saying that I am not into the InterServer code at
all. I have barely looked at it, let alone debugged. So what follows
might well be false ;-)
I don't think there is a memory leak.
There is one "global" Statement object which is meant to be reused.
Hence Session::executeUpdateStatement only allocates new memory if
the "global" statement is yet allocated. The pointer is stored in the
"global" JIBSNet instance, for JIBSRemote::execute_query_statement
this is the line jibsNet_.put_ref ((IB_REF) statement);
The getStatementExecuteData call gets the reference back.
JIBSRemote::close_statement is supposed to delete a statement
reference.
Again, I could well be wrong, so I would like to hear what you and
other C++ pros (which I am not) think about it. Mark for instance...
Maybe we are even lucky enough to get some feedback from our Inprise
fellows about that. I hope they are still monitoring this group.
Thanks,
Torsten
P.S. Mark, thanks for standing in for me here at IB-Java. I will be
under heavy workload at least until Oct 09, so currently I don't
manage to care about "my pet-project" very often.
Well, I read that you are busy as well, but _you_ don't ever sleep,
do you? ;-)
let me start by saying that I am not into the InterServer code at
all. I have barely looked at it, let alone debugged. So what follows
might well be false ;-)
I don't think there is a memory leak.
There is one "global" Statement object which is meant to be reused.
Hence Session::executeUpdateStatement only allocates new memory if
the "global" statement is yet allocated. The pointer is stored in the
"global" JIBSNet instance, for JIBSRemote::execute_query_statement
this is the line jibsNet_.put_ref ((IB_REF) statement);
The getStatementExecuteData call gets the reference back.
JIBSRemote::close_statement is supposed to delete a statement
reference.
Again, I could well be wrong, so I would like to hear what you and
other C++ pros (which I am not) think about it. Mark for instance...
Maybe we are even lucky enough to get some feedback from our Inprise
fellows about that. I hope they are still monitoring this group.
Thanks,
Torsten
P.S. Mark, thanks for standing in for me here at IB-Java. I will be
under heavy workload at least until Oct 09, so currently I don't
manage to care about "my pet-project" very often.
Well, I read that you are busy as well, but _you_ don't ever sleep,
do you? ;-)
--- In IB-Java@egroups.com, "Ken Richard" <kenr@a...> wrote:
> Here is the "big" memory leak that I found. The cvs at source
forge is not
> currently functional, so I will just put the code here. Is there
anyone
> "leading" interclient development? What should I do with my fix?
>
> The statement is allcoated in the call to executeUpdateStatement.
The
> pointer is on the stack and never stored anywhere else. The code
never
> deleted the statement.
>
> OLD_CODE:
> void
> JIBSRemote::execute_update_statement ()
> {
> IB_Statement *statement;
> IB_STRING cursorName;
> IB_STRING sql;
> IB_SSHORT16 timeout;
> IB_SSHORT16 maxFieldSize;
> IB_SLONG32 fetchSize;
>
> getStatementExecuteData (statement,
> cursorName,
> sql,
> timeout,
> maxFieldSize,
> fetchSize);
>
> IB_SLONG32 updateCount;
> session_.executeUpdateStatement (statement,
> updateCount,
> sql,
> (IB_SLONG32) timeout,
> maxFieldSize,
> cursorName);
>
> jibsNet_.resetMessage ();
> jibsNet_.put_code (MessageCodes::SUCCESS);
> jibsNet_.put_ref ((IB_REF) statement);
> jibsNet_.put_slong32 (updateCount);
> }
>
>
>
> NEW_CODE:
> void
> JIBSRemote::execute_update_statement ()
> {
> IB_Statement *statement;
> IB_STRING cursorName;
> IB_STRING sql;
> IB_SSHORT16 timeout;
> IB_SSHORT16 maxFieldSize;
> IB_SLONG32 fetchSize;
>
> getStatementExecuteData (statement,
> cursorName,
> sql,
> timeout,
> maxFieldSize,
> fetchSize);
>
> IB_SLONG32 updateCount;
> session_.executeUpdateStatement (statement,
> updateCount,
> sql,
> (IB_SLONG32) timeout,
> maxFieldSize,
> cursorName);
>
> jibsNet_.resetMessage ();
> jibsNet_.put_code (MessageCodes::SUCCESS);
> jibsNet_.put_ref ((IB_REF) statement);
> jibsNet_.put_slong32 (updateCount);
>
> delete statement;
> }
>