The RpcSmSwapClientAllocFree function exchanges the memory allocation and release mechanisms used by the client stubs with one supplied by the client.
#include <rpc.h>
RPC_STATUS RPC_ENTRY RpcSmSwapClientAllocFree( 
  RPC_CLIENT_ALLOC  *  pfnAllocate,   
  RPC_CLIENT_FREE  *  pfnFree,        
  RPC_CLIENT_ALLOC **  pfnOldAllocate,   
  RPC_CLIENT_FREE  **  pfnOldFree     
);
 The RpcSmSwapClientAllocFree routine exchanges the current memory allocation and memory freeing mechanisms with those supplied by the client.
| Value | Meaning | 
|---|---|
| RPC_S_OK | Success | 
| RPC_S_INVALID_ARG | Invalid argument(s) | 
  Windows NT:  Yes
  Windows CE:  Unsupported.
  Header: Declared in rpcndr.h.
  Import Library: Link with rpcrt4.lib.
RpcSmAllocate, RpcSmFree, RpcSmSetClientAllocFree