Need Help:
Why Dynamic memory allocation by using pointers provides an efficient way of utilizing computer memory but such memory allocation may be problematic if not handled properly in program.

So, what is your question? Have you written some sample code for us to look at?

In any case, heap management is what you are talking about, and there are a lot of techniques to properlyl manage it. How you do it in C vs C++ are very different, and different techniques can be used with different size objects in either to great effect. One of the big problems is heap fragmentation which happens when you do a lot of allocations and deallocations of small things, such as strings or small structures/classes. This can cause severe memory consumption over time for long running applications, such as servers.

you can take a look at my src, which needs dynamic memory allocation for file data, with the added operation of pointer testing and verification:
https://www.dropbox.com/home/Universal_Model_Converter/API/backend

for a usage example, look at "interface test.py".
the class in "magic" is actually updated to the new data type from within the interface.

I've tried my best to optimize as much as possible, but my best still isn't perfect, and I'm sure more can be done.
also note that this interface is still deep into development, so there's alot that's unfinshed.