C
CBFalconer
rahul said:malloc() library function uses brk() and sbrk() to increase the
address space of a process. sbrk() is a system call that ask
the kernel to allocate space at the end of "data segment" of
the process. So, the address returned by malloc() should always
be greater than the end of data segment.
Now, the end of data segment may be found by printing the address
of the symbol "end" or the address of the symbol "_end". These
symbols are defined with the appropriate values by the linker.
Or you may use "objdump" to find out the addresses of data segments
of your executable.
This sort of answer illustrates the danger of allowing Trollsdale
posts to go unchallenged. brk/sbrk are not part of the C
standard, and their actions (if present) are non-portable and thus
immaterial on c.l.c. Everybody should be aware that ANYTHING
written by Tisdale aka Trollsdale is immediately suspect and
probably nonsense.