On 30/08/2019 08:56, Dmitry Yemanov wrote:
> 27.08.2019 3:59, Adriano dos Santos Fernandes wrote:
>>
>> Sometimes a object managed by memory-pool may embed non-pooled memory or
>> other resources.
>>
>> If the main object is not explicitly destroyed, i.e., destroyed by pool,
>> the embedded objects leak.
>
> True. And this requires us to avoid the "delete-by-pool" practice and
> destroy such objects explicitly. Which is usually good per se, unless
> performance is affected (e.g. millions of small objects inside the pool).
>

And such objects may be embedded in some container with million objects.

Small pieces (classes) should have own defined behavior that always
works, but currently it's impossible as we don't known where a well
defined small piece will be used.

Currently the request should handle that explicitly, which is bad. With
the finalizers, classes may work in both situations (delete or delete by
pool).


>> I've added a way in the work/re2 branch to attach these resources to
>> memory pool lifecycle and detach if the main object is explicitly
>> destroyed.
>>
>> https://github.com/FirebirdSQL/firebird/commit/ff06569f127caf3128a5b3290f67eb468f86fe8d
>>
>
> Generally, I don't mind. Although see above, explicit destruction may
> be a better way to handle the resource lifetime.

For example, when it's used in gbak it does that.

I just don't wanna insert explicit hooks in request deletion to destroy
SimilarToRegex objects explicitly.


Adriano



Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to