skip to main content
OpenAccess SDK SQL Engine Core Functions API : Memory management : OAIP_execute
 

OAIP_execute

You must implement your IP to call dam_getMemTree to get the memory tree associated with the execution of the query being processed. Any memory that needs to be allocated for query execution should be done on this memory tree using xm_allocItem. When the query execution is complete, the IP should free all the memory using xm_freeItem. The IP should not free the memory tree returned from dam_getMemTree().
Note that if the IP does not release memory by calling xm_freeItem, the OpenAccess SDK SQL engine releases all the memory after the query is completely executed. In JOIN queries, when large data sets are joined, inner tables are queried multiple times. All of the memory allocated by the IP is released only when the JOIN query is fully processed. This causes problems when executing large queries where the memory resource limit of the process is exceeded. So it is essential that the IP frees up all memory before returning from IP execute. Note that when the IP is operating in cursor mode (where IP Execute returns after building a block of results), the IP should free memory when returning from IP_EXECUTE after the last block of results are returned.