[redland-dev] missing release_handle in rdf_storage_postgresql ?
Lauri Aalto
laalto at gmail.com
Wed Mar 7 05:38:11 EST 2012
Hi Maxence,
the database connection is still needed when the stream is being
iterated. RDF statements are pulled from the db only one at the time.
If the db connection is released while the stream is still alive,
calling librdf_stream_next() would fail.
To optimize db connection lifetime, call librdf_free_stream() as early
as possible.
Lauri
On Wed, Mar 7, 2012 at 12:15 PM, Maxence Guesdon
<Maxence.Guesdon at inria.fr> wrote:
> Hello,
>
> In function librdf_storage_postgresql_find_statements_with_options of
> rdf_storage_postgresql.c, the function gets a new db handle with
> librdf_storage_postgresql_get_handle
> but in case of success, it is not released.
>
> In fact, it is, but later, when the returned stream is freed, thanks to the
> pointer on librdf_storage_postgresql_find_statements_in_context_finished
> passed as finalization function to librdf_new_stream.
>
> Wouldn't it be better to release the db handle as soon as possible ?
> For example, by adding
> librdf_storage_postgresql_release_handle(sos->storage, sos->handle);
> just before the final
> return stream;
> ?
>
> Regards,
>
> Maxence
>
> _______________________________________________
> redland-dev mailing list
> redland-dev at lists.librdf.org
> http://lists.librdf.org/mailman/listinfo/redland-dev
More information about the redland-dev
mailing list