need ib_util_free to complement ib_util_malloc
----------------------------------------------

                 Key: CORE-3826
                 URL: http://tracker.firebirdsql.org/browse/CORE-3826
             Project: Firebird Core
          Issue Type: Improvement
          Components: Engine
    Affects Versions: 2.5.0
         Environment: any
            Reporter: Ray Holme
            Priority: Minor


It is reasonable to allocate memory in a UDF and then abort the operation. It 
would be better if the UDF code could free the allocated memory.
It is also possible to allocate multiple chunks of memory and only return one 
to the caller.

While it is possible that the engine frees memory even if it is not used 
(FREE_IT), it is also reasonable for the code to allocate multiple memory hunks 
during the course of a function and only leave the last one to be free'd - 
sometimes only one hunk but the UDF aborts and returns 0. In the case of a long 
running transaction with lots of UDF calls per row, it is also possible to eat 
all memory before the clever engine decides to free unused hunks by transaction 
(assuming it does that as that is what I would do).

Instead, the coder must malloc the additional or conditional hunks (is this 
handled by FREE-IT if using ib_util_malloc?) and cannot free anything malloc'd 
by the ib CALL.
If it is a conditional chunk, then when it is decided to use it, an additional 
call to ib_util_malloc is required and then a plain free would be used.

This is a double potential memory leak problem.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to