Check max stack trace length and dont break memory