Hi,
I have written a small program and compiled it under Solaris/Linux platform to measure the performance of applying this code to my application.
The program is written in such a way, initially using sbrk(0) system call, i have taken base address of the heap region. After that i have allocated an 1.5GB of memory using malloc system call, Then i used memcpy system call to copy 1.5GB of content to the allocated memory area. Then, I freed the allocated memory.
After freeing, i used again sbrk(0) system call to view the heap size.
This is where i little confused. In solaris, eventhough, i freed the memory allocated (of nearly 1.5GB) the heap size of the process is huge. But i run the same application in linux, after freeing, i found that the heap size of the process is equal to the size of the heap memory before allocation of 1.5GB.
I know Solaris does not frees memory immediately, but i don't know how to tune the solaris kernel to immediately free the memory after free() system call.
Also, please explain why the same problem does not comes under Linux?
Can anyone help me out of this?
Thanks,
Santhosh.