Is Infinite Recursion Dangerous
“Is Infinite recursion dangerous”
Summary
Infinite recursion never reaches a base case, causing unbounded growth of the call stack and exhausting memory. This typically results in stack overflow, program crashes, or system instability and can be exploited for denial‑of‑service attacks, making it hazardous for software and computers.
Sources 60 searched
- The never-ending recursion - ScienceDirect
On this view, recursion is a property of the mind/brain. The second one disregards this conception of recursion and redefines it in terms of either the processing of self-embedded structures (e.g. [20]) or the ability to represent multiple hierarchical levels using the same rule (e.g.
- Recursion
Here's another example; this version does have a base case, but the call badPrint2(2) will still cause an infinite recursion: void badPrint2( int k ) { if (k < 0) return; System.out.println(k); badPrint2( k+1 ); } This inspires: ... Every recursive method must make progress toward the base case to prevent infinite recursion.
- 18.10: Infinite Recursion - Engineering LibreTexts
If a recursion never reaches a base case, it goes on making recursive calls forever, and the program never terminates. This is known as infinite recursion, and it is generally not a good idea.
- Infinite recursion - Python Help - Discussions on Python.org
In python version 3.13… I noticed the possibility of creating infinite recursion, that is, the stack does not overflow, this could be attributed to optimizing the “tail” recursion, but memory measurements showed that memory is consumed until it runs out.
- Stack overflow - Wikipedia
When a program attempts to use more space than is available on the call stack (that is, when it attempts to access memory beyond the call stack's bounds, which is similar to a buffer overflow), the stack is said to overflow, typically resulting in a program crash. The most common cause of stack overflow is excessively deep or infinite recursion, in which a function calls itself so many times that the space needed to store the variables and information associated with each call is more than can fit on the stack.
- Infinite regress - Wikipedia
So the regress starts with the fact that X is F. According to the recursive principle, this is only possible if there is a distinct Y that is also F. But in order to account for the fact that Y is F, we need to posit a Z that is F and so on. Once the regress has started, there is no way of stopping it since a new entity has to be introduced at each step in order to make the previous step possible. An infinite regress argument is an argument against a theory based on the fact that this theory leads to an infinite regress.
- Finite and Infinite Recursion with examples - GeeksforGeeks
As the base condition is never met, the recursion carries on infinitely.
- c++ - Why infinite recursion leads to seg fault - Stack Overflow
When you use it all up and try to access beyond what you have, the system will generate an exception which may ultimately result in a seg fault if the memory it tried to access was write-protected.
- Can Infinite Recursion Harm Computer - Livelaptopspec
An infinite loop will cause unexpected consumption of resources, such as CPU cycles or memory. This infinite loop will consume system resources and can be used to create a denial of service attack. Key Differences between Recursion and Iteration Infinite recursion can lead to system crash whereas, ...