I\'m working on designing the kernel (which I\'m going to actually call the \"core\" just to be different, but its basically the same) for an OS I\'m working on. The specifics o
Are you confusing the heap and the stack?
I ask because you mention "an ever expanding piece of memory", scope and pushing variables on the heap as they are declared. That sure sounds like you are actually talking about the stack.
In the most common C implementations declarations of automatic variables like
int i;
are generally going to result in i being allocated on the stack. In general malloc won't get involved unless you explicitly invoke it, or some library call you make invokes it.
I'd recommend looking at "Expert C Programming" by Peter Van Der Linden for background on how C programs typically work with the stack and the heap.