memory management for local variables
Posted: Tue Mar 27, 2012 6:26 am
can anyone tell me how memory is allocated to variables declared in function(local variables)
lets say i have a kernel. now i know that dynamic allocation would start at the end of the kernel.
but where in memory are local variables stored??
i tried to figure out experimantally and what i found that local variables were give address<end of kernel
also with each new variable the address given was smaller than the last one.
is memory given to local variables from one of the following sections declared in link file(the text, bss, code section).
and also since memory address given to local variables is downwards(or in decreasing order) . is there any way to increase the space for local variables.
also once the function is returned will the memory address given to new local variables replace the ones that were already allocated the previous local variables or it will just keep going downwards.
lets say i have a kernel. now i know that dynamic allocation would start at the end of the kernel.
but where in memory are local variables stored??
i tried to figure out experimantally and what i found that local variables were give address<end of kernel
also with each new variable the address given was smaller than the last one.
is memory given to local variables from one of the following sections declared in link file(the text, bss, code section).
and also since memory address given to local variables is downwards(or in decreasing order) . is there any way to increase the space for local variables.
also once the function is returned will the memory address given to new local variables replace the ones that were already allocated the previous local variables or it will just keep going downwards.