When we use malloc() to allocate memory, should we give the size which is in power of two? Or we just give the exact size that we need? Like
malloc()
It might have been true once, but it's certainly not better.
Just allocate the memory you need, when you need it and free it up as soon as you've finished.
There are far too many programs that are profligate with resources - don't make yours one of them.