You must implement your IP to call dam_getMemTree to get the memory tree associated with the execution of the query being processed. The IP should free all memory before returning from OAIP_dll. Do not free the memory tree that is passed in as an argument.