Declaring UDFs with FREE IT
From InterBase
Go Up to Declaring a UDF to a Database
InterBase FREE_IT
keyword allows InterBase users to write thread-safe UDF functions without memory leaks.
Whenever a UDF returns a value by reference to dynamically allocated memory, you must declare it using the FREE_IT
keyword in order to free the allocated memory.
Note:
You must not use
You must not use
FREE_IT
with UDFs that return a pointer to static data, as in the “multi-process version” example on page Thread-safe UDFs.The following code shows how to use this keyword:
DECLARE EXTERNAL FUNCTION lowers VARCHAR(256)
RETURNS CSTRING(256) FREE_IT
ENTRY POINT 'fn_lower' MODULE_NAME 'ib_udf'