M
M
Maxim Siomin2020-09-29 21:17:49
C++ / C#
Maxim Siomin, 2020-09-29 21:17:49

Why is the stack so small?

Large programs consume a lot of RAM. And the stack is only 1 mb. It turns out that gigabytes of RAM are occupied by types
object
string
class
interface
delegate
And another sub-question:
There is a class. It contains an int variable. Does it occupy memory on the stack or on the heap?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-09-29
@freeExec

You save only a link to the stack, and gigabytes are allocated somewhere there. Well, the stack may not be 1 MB, but is set in the PE header of the executable file during compilation, as long as the compiler considers it necessary.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question