Hello
sonali
If this is a new development and if you are going to use multi-thread processes (pthread), and if they will live very long time, and if you are going to develop in C++.
Then I recommend you to use
smart pointers and
exceptions ( for error handling ) .
You could read about smart pointers at
Boost C++ Libraries and also you can create such by yourselves. Pure C++ without any C influence. I've used such technique and the result is very nice. Programming is close to JAVA style. All resources allocated at constructor, deallocation at destructor. Check also what's written about C++ exception at the C++ standard.
There is other ways too. For example you can spawn new processes for each new "task", allocate and do not free anything, When the task is completed terminate the process, and OS will free everything.
Nevertheless which approach you gonna use to deal with "Memory/Resource Leaks"
Use
valgrind to check what's up.
Best Regards
O.