You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stack overflow and heap crash/out-of-memory programs: write program to check stack size in single-threaded program; also try to make it NOT require alloca(), which is Linux-specific
#4
write a program to check stack size in single-threaded program, and withOUT alloca() for both multi and single-threaded versions.
For the NON-alloca() version, I think you can simply use a for loop with static allocation of increasingly-large arrays until it crashes, allocating the whole array at once each for loop iteration.
Also, add a heap crash program in addition to this stack overflow/crash program! Write program to crash the PC by allocating on the heap continually up to specified amount (ex: 1 GB, 10 GB, etc.). When the user allocates more than is available with both RAM and swap (virtual memory) combined, it should crash the whole PC, or at least freeze or lock it up, right? Let's see.
The text was updated successfully, but these errors were encountered:
ElectricRCAircraftGuy
changed the title
Write program to check stack size in single-threaded program; also try to make it NOT require alloca(), which is Linux-specific
Stack overflow and heap crash/out-of-memory programs: write program to check stack size in single-threaded program; also try to make it NOT require alloca(), which is Linux-specific
Feb 14, 2021
Looking at this program: https://github.com/ElectricRCAircraftGuy/eRCaGuy_hello_world/blob/master/c/onlinegdb--empirically_determine_max_thread_stack_size_GS_version.c
...and my answer here: https://stackoverflow.com/questions/1825964/c-c-maximum-stack-size-of-program/64085509#64085509
Try to do the following:
alloca()
version, I think you can simply use afor
loop with static allocation of increasingly-large arrays until it crashes, allocating the whole array at once each for loop iteration.The text was updated successfully, but these errors were encountered: