Merge pull request #1011 from hpbuniat/array-recursion

Less memory-consuming way to detect array recursions