How to set the default heap size of a c program
Hi,
I am trying to find out if the event of hitting default heap limits and then the subsequent expansion of heap size by libc is impacting the performance of my application.
To test that I want to set the program to run with an initial heap size which is small enough. what is the API/command to set the default heap size of a program ? [ I am not talking about the max heap size which can be set thro' ulimit, I only want to change the default heap size with which a process starts]
[504 byte] By [
su_su] at [2007-11-26 8:37:00]

# 1
This is probably a link editor parameter, see the linker and loader guide.
Another thing you can do is write your own sbrk() that will log whenever it's called, so you can at least see how many times it's called and with what values. If you really need in-depth instrumentation, write your own heap routines and give them the same names as the CRTL routines. The linker should find yours first and route all memory operations through them. At least, that's the way it worked for me on SunOS 4.1....