Suppose you've allocated a certain number of bytes but later find that you want to add values to it. You could copy everything into a larger memory area, which is inefficient, or you can allocate more bytes using realloc, without losing your data. So far so good...

But does this also means that I can make the memory area smaller? In my app I allocate a BIG area of memory (to be safe) because I don't know how much I need. After this area is used I want to release the memory I don't need. Is that possible with realloc?

Example: My memory area is 10000 bytes. I only use for example 1000 bytes. I want to release 9000 bytes.