Reputation: 11
I've been messing around with assembly for a while and I found things which seems inconsistent. After some research I have some questions about stack / static (initialized/uninitialized) / heap memory.
First of all, does memory freed out of the heap, becomes available for other processes? Sometimes I hear that heap only limitation is RAM memory limit, but then it must mean that unused memory is available for other processes. Meanwhile custom malloc implementation just initialize heap of some size, which definitely reserve this space, not letting other programs use it.
Second of all, I've created once a float variable in C and compile it to assembly. One of the results was the label with .long
property/parameter (not sure about gcc assembly) and number after it being equal to decimal value of IEEE 754 representation of the value I chose. So, I guess it's the same as the static allocation (so it uses memory in the whole lifespan of runtime). But then, it allocated the value from this label on the stack. Weird I guess...
After all of these I just wander, when is static allocation (outside of global variables) is good for "variables which at the first look shouldn't be allocated statically".
I've watched some videos and searched for my questions but I didn't find an answer. A few experiments in NASM assembly with floating-point put me here.
Upvotes: 1
Views: 59