Memory Allocation On Stack

Andrew Haley aph-gcc@littlepinkcloud.COM
Fri Jul 20 10:29:00 GMT 2007


Pankaj Kohli writes:

 > I wrote a simple C program to test the memory allocation for local
 > variables. But when i try to disassemble the program using gdb, it
 > shows that 16 bytes are being reserved for local variables on the
 > stack, although i declared a single integer variable which is supposed
 > to take only 4 bytes.
 > Can anyone tell, why it is reserving 16 bytes on the stack for just a
 > single variable ?

This question was asked on the kernel list on May 19, 2007.  Please
find the answer at http://kerneltrap.org/node/8236

Andrew.



More information about the Gcc-help mailing list