Subject Re: [Firebird-Java] How to make the garbage collector collect
Author Markus Plail
"Roman Rokytskyy" <rrokytskyy@...> writes:

>> I am writing webapps, that use Firebird databases. I have on db for
>> every service and wanted to know if there is any possibility to get
>> my XSQLVARs garbage collected other than to shutdown my
>> FBWrappingDataSource und create a new instance.
>
> By default pool has also statement pooling switched on. That means
> that even after closing the pooled connection, physical connection
> will reference prepared statements and ready for use. Set the
> "maxStatements" property to 0, it will switch the statement pooling
> off. In this case closing the prepared statement will also deallocate
> all structures incl. XSQLVAR and XSQLDA.

Very good to know, thanks :-)

> But my question is: do they cause any troubles in your application?

When there are hundreds of thousand, yes. After inserting 3000 entries
in my database, I have mor than 300000 XSQLVARs lying around and I am
getting short of heap space.

>> Btw. it's not possible to:
>> FBWrappingDataSource fbWrapDs = new FBWrappingDataSource();
>> fbWrapDs.setDatabase("//" + URL + ":" + PORT + "/" +
>> db = new Firebird(fbWrapDs.getConnection());
>> ... do smth ...
>> fbWrapDs.getConnection().close();
>> fbWrapDs.shutdown();
>> fbWrapDs.restart();
>
> If I'm not mistaken, simple restart() should be enough.

A simple restart didn't free the XSQLVARs. I had to shutdown().

> But the NullPointerException is clear bug and should not be
> there. Please fill a bug report, I will fix this in next point
> release.

Will do so.

regards
Markus