Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ElectricRCAircraftGuy opened this issue Feb 14, 2021 · 0 comments

Comments

@ElectricRCAircraftGuy
Copy link
Owner

ElectricRCAircraftGuy commented 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:

  1. write a program to check stack size in single-threaded program, and withOUT alloca() for both multi and single-threaded versions.
    1. 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.
  2. 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.
@ElectricRCAircraftGuy 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant