How to guard against inifinte loops?
When GtProcessStackOverflowChecker
is installed on a process, it raises an exception when it detects GtStackOverflowError
. See the example below.
testStackOverflow <gtExample> GtStackOverflowChecker suspendStackOverflowWatchersDuring: [ | end overflowed | overflowed := false. GtProcessStackOverflowChecker startForProcess: Processor activeProcess. end := DateAndTime now + 2 seconds. [self recurseUntil: [DateAndTime now > end]] on: GtStackOverflowError do: [overflowed := true]. self assert: overflowed]