reduce maximum recursion depth in marking to try to avoid stack overflow.
fixes #6240