Enable the AUTOFREE feature
You can enable the AUTOFREE feature for the
Informix® ESQL/C application
in either of the following ways:
- Set the IFX_AUTOFREE environment variable
to
1
.When you use the IFX_AUTOFREE environment variable to enable the AUTOFREE feature, you automatically free cursor memory when cursors in any thread of the program are closed.
- Execute the SQL statement, SET AUTOFREE.
With the SET AUTOFREE statement, you can enable the AUTOFREE feature for a particular cursor. You can also enable or disable the feature in a particular connection or thread.
Important: Be careful when you enable the AUTOFREE
feature in legacy Informix®
ESQL/C applications.
If a legacy application uses the same cursor twice, it generates an
error when it tries to open the cursor for the second time. When the
AUTOFREE feature is enabled, the database server automatically frees
the cursor when it closes it. Therefore, the cursor does not exist
when the legacy application attempts to open it a second time, even
though the application does not explicitly execute the FREE statement.
For more information about the IFX_AUTOFREE environment variable, see the Informix® Guide to SQL: Reference.