I am working an OS program and I am trying to figure out how malloc works pertaining to the stack. When a user calls malloc, is the pointer returned from malloc at the top of the stack and after the given space or at the bottom of the given space?
If I am loading variables into this new space using assembly code, and it isn't enough to fill the whole space, should the variables be pushed in at the beginning of the freed space, or pushed to the point where the last variable would take up the last amount of free space given from malloc?
Thanks.