Any objects created by the API are managed by the API. You do not need to worry about memory. Use methods in your programming language to free memory for other objects.
Forcing a service instance to restart is one way to control memory leaks.
If you are using a service wrapper to execute UNIX commands and return results to the client, note that the service wrapper is implemented with fork/exec in the onInvoke() call. The onInvoke() call and other calls in Symphony are executed in a thread.
LIBS = -L $(OUTPUT) -L $(TOP)/$(ARCH_BUILD)/lib \-lsampleCommon -lsoambase -lsoamapi -lpthread