On 21/06/2021 15:17, Jiří Činčura wrote:
> Hi *,
> 
> I think I have an example of memory leaking when using external engine plugin 
> (3.0.7, 4.0.0).
> 
> Here's as simple implementation as I can make it (sorry for probably 
> non-idiomatic C++ code): 
> https://gist.github.com/cincuranet/aa207081dc0d44e5d06c1a4890019307 . Then I 
> create a dummy function in a database `CREATE FUNCTION TEST RETURNS INTEGER 
> ENGINE MEMORYDEMO`. Finally I run `select test() from rdb$database where 0=1` 
> in a loop using isql (open-execute-close) using simple script (in this case 
> PowerShell flavor) below. Given the `0=1` the function is actually never 
> called (and for good measure I have `exit(EXIT_FAILURE)` there), but at least 
> the plugin is used.
> 
> while ($true) {
>       'select test() from rdb$database where 0=1;' | & $isql -u sysdba -p 
> masterkey 'localhost:memory.fdb';
> }
> 
> This results in this memory usage (and as far as I can tell from couple of 
> long runs, it keeps growing):
> https://snipboard.io/g5Lzya.jpg
> 
> Am I doing something wrong? Or is this a bug?
> 

I'm testing with the example function:

create function sum_args (
    n1 integer,
    n2 integer,
    n3 integer
) returns integer
    external name 'udrcpp_example!sum_args'
    engine udr;

select sum_args(1, 2, 3) from rdb$database where 1 = 0;

I put breakpoint in UdrEngine.cpp here:

        ~SharedFunction()
        {
                engine->deleteChildren(children);
        }

And engine calls it.

Can you do the same test using sum_args?


Adriano


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

Reply via email to