Subject Re: [Firebird-Java] Re: Should (Could) FBStatements be held in WeakHashMap
Author Mark O'Donohue
Robert DiFalco wrote:
> I just wanted to state my concern for adding memory and processor
> overhead to benefit those whose code is in error. After all, closing a
> statement is a requirement, not just "a good thing to do". I'm not crazy
> about having to pay with the maintenance of Weak References, Reference
> Queues, and casts for those whose code is in error.
>

The overhead is very trivial and the usage is not in a heavily
time/memory critial region of operation.

The main extra resourse used is a weak reference object per Statement
object. So it's not like it was every string operation for instance.


> If this is an issue (and I'm not sure why it should be), I would prefer
> to have a DEBUG mode that tracks statements and their resource
> consumption. By turning this flag on I could tell that I'm am not
> properly closing resources without imposing a hit on those who are using
> resources properly.
>

Sure it's worth checking, but the implemntation is fairly simple, and
fairly close to as cost efficient as the original, checking a debug flag
would likely consume more cpu time than was added to the routine.


Cheers

Mark