You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recursive queries may leak some amount of memory from the request pool. This may be a big problem if the request is a trigger or a procedure, as this memory never gets deallocated until disconnection (or trigger/procedure recompile). In the test I have at hands (cannot be shared, unfortunately) every insert leaks about 20MB because of this issue (WITH RECURSIVE in the AFTER INSERT trigger).
All the leaked memory chunks are allocated in VIO_record():
record = rpb->rpb_record = FB_NEW_RPT(*pool, format->fmt_length) Record(*pool);
and lost after this code in RSBRecurse::get():
// Don't overwrite record contents at next level of recursion.
// RSE_open and company will allocate new record if needed
rpb->rpb_record = NULL;
I have tried the following solution in RSBRecurse::close():
Could not reproduce on 2.5.0 with trivial AI trigger which uses recursive query as source to insert statement.
Any hint about how test can be done will be appreciated.
The text was updated successfully, but these errors were encountered:
Test Details: Could not reproduce on 2.5.0 with trivial AI trigger which uses recursive query as source to insert statement.
Any hint about how test can be done will be appreciated.
Submitted by: @dyemanov
Recursive queries may leak some amount of memory from the request pool. This may be a big problem if the request is a trigger or a procedure, as this memory never gets deallocated until disconnection (or trigger/procedure recompile). In the test I have at hands (cannot be shared, unfortunately) every insert leaks about 20MB because of this issue (WITH RECURSIVE in the AFTER INSERT trigger).
All the leaked memory chunks are allocated in VIO_record():
record = rpb->rpb_record = FB_NEW_RPT(*pool, format->fmt_length) Record(*pool);
and lost after this code in RSBRecurse::get():
// Don't overwrite record contents at next level of recursion.
// RSE_open and company will allocate new record if needed
rpb->rpb_record = NULL;
I have tried the following solution in RSBRecurse::close():
+ char* p = tmp + inner_size;
+ for (int i = 0; i < streams; i++)
+ {
+ record_param* rpb = (record_param*) p;
+ delete rpb->rpb_record;
+ p += sizeof(record_param);
+ }
and it seems to help (leaks disappear). Maybe a better solution could be suggested instead.
Commits: b060fb4 52ed454 d461d8f
====== Test Details ======
Could not reproduce on 2.5.0 with trivial AI trigger which uses recursive query as source to insert statement.
Any hint about how test can be done will be appreciated.
The text was updated successfully, but these errors were encountered: