When does the stack really overflow? -
Is infinite recording possible only for one reason or other reasons? Does the size of the pile increase according to the size of the stack?
Sorry if this question has been asked earlier, then they would appreciate the link, if that is the case.
I can not talk for all platforms, but as it happens, I have some time Windows .exe files (I mean, actually studying the binary format of them - I think that we all work with executable files here;)) I bet that most of the other platforms are similar Capabilities are, but I am immediately acquainted with them I'm not.
Part of the file format contains two values related to the current discussion:
typedef struct _IMAGE_OPTIONAL_HEADER {... DWORD SizeOfStackReserve; DWORD SizeOfStackCommit; ...} IMAGE_OPTIONAL_HEADER32, * PIMAGE_OPTIONAL_HEADER32;
From MSDN:
sizeoffstack reserve
The number of bytes reserved for the stack is only the sizeOfStackCommit member Specified by the memory load time is committed; The rest one page is made available at a time until it reaches the reserve size.
SizeOfStackCommit
The number of bytes for the stack.
In other words, the linker specifies the maximum size for the program's stack. If you press the maximum size, you overflow - regardless of how you affect the maximum size. You can write a simple program in one line of code, assigning a stack variable (say, an array), which is larger than the maximum stack size. Or you can do this by infinite (or finite, but very deep) recapitulation or by assigning lots of stack variables.
Microsoft Linker has default system on X86 platforms). For a modern system, it seems small on its face, however, the more modern versions of Windows interpret these values a little differently. Instead of completely stacking the stack, it will use the stack of physical memory. If your stack goes beyond this, the virtual memory will be included in it, so you should still be good ... assuming you have enough virtual memory. Remember, it is possible to run is out of memory, even on modern systems, large amounts of RAM and lots of virtual memory on disk. All you really need to do is allocate large amounts of data.
So, the long story short: Is it possible to eliminate the heap of infinite rings? Undoubtedly. Is this likely? Not really, unless you're actually allocating big items.
Comments
Post a Comment