I want to understand how OOP programming languages differs from procedural languages in terms of memory utilization. To be more specific, let's assume we are talking about Java
and C
as examples:
- Is it true that objects are automatically stored in
heap
while in procedural languages you have to explicitly define the heap usage such as in Cmalloc
? - If I write a program in C,
OS
will create a virtual page of this program including heap and stack spaces. If I don't usemalloc
in my code, this means my program does not utilize the heap allocated for it, is that correct? - Since
Stack
is used to store local variables and function call addresses, what if a program ran out of Stack space, doesOS
extend the paging size of this program or it just uses the heap as an extension?