[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Garbage Collection
- From: "David Burgess" <david@...>
- Date: Tue, 30 Jul 2002 21:21:16 +1000
I am using ls_odbc.c which uses a totally different
scheme to ls_pg.c. I am testing in Win32 and trying to
implement on IBM DB2.
I think I have sorted some of my problems by moving some
of the code from ls_pg.c to ls_odbc.c. The malloc of env
handles in ls_odbc was a leak.
> lua_pushusertag(L, conn, env->conn_tag);
> cursor->conn = lua_ref(L, 1);
> /* gc method closes handle, does lua_unref(L, cursor->conn);
> and presumably relies on gc to clean up the cursor userdata */
> See the code above? The reference ensures that the connection object
> will not be GCed before the cursor object is GCed. Is this not working?
it works. However, I am not sure about the ODBC equivalent.
My bug, (which is hard to cause and harder to debug) occurs
after lots of selects and I get an "invalid SQL handle" reported
from DB2. It would seem that the handle (stmt handle) has been
closed. I presume that the gc has closed it. Methinks that the
gc is being invoked during the fetch loop.
Also, Can you explain the code in ls_pg.c that reads
/* Change tag. Otherwise we will create another userdata when we push it.