Home | Previous Page | Next Page   Creating User-Defined Routines > Developing a User-Defined Routine > Changing a UDR >

Unloading a Shared-Object File

In an attempt to keep memory usage to a minimum, the routine manager attempts to unload a shared-object file when it finds that no one is using any of its UDRs. That is, it unloads a shared-object file when all references to the UDRs within the shared-object file are removed from the internal cache of the database server and any one of them is marked as being dropped.

The database server cleans up its cache entries when you take any of the following actions:

For example, in the following SQL fragment, the shared-object file thrashes in and out of memory because the transaction has private cache entries until committed and the management mechanism treats them as being dropped:

BEGIN WORK;
CREATE FUNCTION c_func( ) ...;
CREATE FUNCTION spl_func( ) RETURNING c_func( )...;
COMMIT WORK;

To unload a shared-object file, you can take any of the following actions:

For the syntax of the ifx_unload_module( ) and ifx_replace_module( ) functions, see the IBM Informix: Guide to SQL Syntax.

Important:
Do not use the ifx_replace_module( ) function to reload a module of the same name. If the full names of the old and new modules that you send to ifx_replace_module( ) are the same, unpredictable results can occur.

DataBlade modules can be shared across databases. Therefore, you might have more than one database using the same DataBlade module.

In Figure 65, the routine manager has loaded the shared-object file named source1.so. This shared-object file contains definitions for the user-defined functions func1( ), func2( ), and func3( ).

The routine manager sends an entry in the message log file when it loads and unloads a shared-object file. When the routine manager unloads the source1.so shared-object file, the message-log file would contain messages of the form:

19:14:44  Unloading Module </usr/udrs/source1.so>
19:14:44  The C Language Module </usr/udrs/source1.so> unloaded

The message-log file is a useful place to check that the shared-object file is unloaded from the virtual processors. Alternatively, you can use the onstat -g dll command to monitor the results of an shared-object-file unload.

For information about when the shared-object file is loaded, see Loading a Shared-Object File. For information on how to prevent a shared-object file from being unloaded, see Locking a Shared-Object File in Memory.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]