Persistent, single-run, and singleton procedures differ significantly with respect to the removal of instances from the server. You should code your application with the following behavior in mind:
Persistent procedures — Simply delete the proxy handle on the client. This causes the remote instance to be deleted.
Single-run procedures — The remote instance is automatically deleted after execution of each call to an internal procedure or user-defined function. The client should delete the local proxy handle.
Singleton procedures — The remote instance must be explicitly deleted, typically by code within the remote procedure itself. Otherwise, the instance remains in memory, even after the client disconnects, until the server session shuts down. The client should delete the local proxy handle, but doing so does not affect the remote instance.
The behavior described above varies slightly if any client calls a remote procedure with RUN SINGLE-RUN while a singleton instance of the same procedure is already running. In such a scenario, the server session deletes the singleton instance and runs the procedure in single-run mode. The server session does not re-instantiate the singleton until it is explicitly called by a client. Note that combining single-run and singleton calls to the same procedure within the same application is not recommended.