Monitoring the stack

I am getting a deterministic StackOverflowError, and I have so far not managed to reduce it to a MWE. One of my functions in the callstack uses an array comprehension, and when I replace it with a function where I explicitly allocate and fill the array (I wanted to print out values, old fashioned debugging), the error disappears. The stacktrace does not suggest that I have unwittingly caused a recursive call. The short of it, I am puzzled and have too little information to provide so anyone can help.

But: Are there any tools that would allow me to monitor the memory stack?